Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Triggers won't allow me to add records.
Message
From
16/06/2000 03:17:11
Walter Meester
HoogkarspelNetherlands
 
 
To
15/06/2000 23:49:52
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00381170
Message ID:
00381232
Views:
21
Hi Ulises,

>Hi all. First of all let me tell you that my application is coming out very nicely, and I must say a big thank you to all the people who has helped me here.
>Now to my next question:
>I have a form with a grid. The parent part comes from the Products table and the child (the grid) from the inventory table. I have set a relationship in both tables using CodeNumber as the common field.
>I have also set the referential integrity rules as follows:
>Parent-Update:Cascade; Parent-Delete: Ignore; Child-Insert: Restrict.
>When I set the grid to AllowAddNew=.T. and try to input a new record (APPEND, APPEND BLANK)in the grid, I got a "Trigger Failed" message BEFORE writing anything. How can a trigger fail if I haven't written any data? How to avoid this?


You've got a few possibilities:

1. Use an INSERT INTO and fill the required fields inmediatetely.
2. Set record- or tablebuffering to on and commit the insert with a TABLEUPDATE.
3. Use the defaultvalue properies of a table to put any default values in the required fields.


Personally, In your situation, I would enable tablebuffering and update with lError=TABLEUPDATE(2, .T., "yourAlias").

HTH,

Walter,
Walter,
Previous
Reply
Map
View

Click here to load this message in the networking platform