Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RI Delete Restrict Not Working?
Message
From
31/01/2009 20:11:16
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
RI Delete Restrict Not Working?
Miscellaneous
Thread ID:
01378644
Message ID:
01378644
Views:
57
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, instead of the nice framework 'This record is linked...cannot delete." 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
Amanda Morton
System Analyst
Harrisburg Project
Reply
Map
View

Click here to load this message in the networking platform