Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RI Delete Restrict not Working?
Message
 
 
To
31/01/2009 18:43:13
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01378619
Message ID:
01378637
Views:
9
It looks like the Tableupdate() happens on Close and only then the error occurs.

>I have my RI set to restrict delete rules for a child table. My maintenance form lets me delete the parent record with child records linked to it, until I try to close my form. Then I get a trigger failed error. I must be accidently overriding some default behavior? Do I need to set other properties in my business object to make with work correctly?
>I am using MM framework, VFP SP2 on Vista.
>Here is the RI code section:
>
>SELECT (lcParentWkArea)
>pcParentDBF=dbf()
>pnParentRec=recno()
>STORE CID TO lcParentID,pcParentID
>pcParentExpr="CID"
>lcChildWkArea=riopen("users","cgroupid")
>IF lcChildWkArea<=0
>  IF _triggerlevel=1
>    DO riend WITH .F.
>  ENDIF at the end of the highest trigger level
>  RETURN .F.
>ENDIF not able to open the child work area
>pcChildDBF=dbf(lcChildWkArea)
>llRetVal=!SEEK(lcParentID,lcChildWkArea)
>SELECT (lcChildWkArea)
>pnChildRec=recno()
>pcChildID=CGROUPID
>pcChildExpr="CGROUPID"
>IF !llRetVal
>  pnError = rierror(-1,"Delete restrict rule violated.","","")
>ENDIF
>=rireuse("users",lcChildWkArea)
>IF NOT llRetVal
>  IF _triggerlevel=1
>    DO riend WITH llRetVal
>  ENDIF at the end of the highest trigger level
>  SELECT (lcStartArea)
>  RETURN llRetVal
>ENDIF
>IF _triggerlevel=1
>  do riend with llRetVal
>ENDIF at the end of the highest trigger level
>SELECT (lcStartArea)
>RETURN llRetVal
>** "End of Referential integrity Delete trigger for" user_group
>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform