G
Guest
Hi,
I have a form with 2 subforms on it. I have checked off "Enforce
Referential Integrity" and "Cascade Update Fields" and "Cascade Delete
Related Records" in the Edit Relationships window of the 2 relationships
(main to sub1 and main to sub2).
The delete button is on the mainform. My code for deleting a record is:
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
Me.AllowDeletions = True
DoCmd.SetWarnings False ' Suppresses the warning message
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Me.AllowDeletions = False
DoCmd.SetWarnings True ' Turns the warning message setting back on
DoCmd.Close acForm, Me.Name
Exit_cmdDelete_Click:
Exit Sub
Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click
End Sub
After the line "DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
" I get this error: "You entered an expression that has an invalid reference
to the property |."
What is this error and how can I fix it?
Any help is appreciated.
Thanks
I have a form with 2 subforms on it. I have checked off "Enforce
Referential Integrity" and "Cascade Update Fields" and "Cascade Delete
Related Records" in the Edit Relationships window of the 2 relationships
(main to sub1 and main to sub2).
The delete button is on the mainform. My code for deleting a record is:
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
Me.AllowDeletions = True
DoCmd.SetWarnings False ' Suppresses the warning message
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Me.AllowDeletions = False
DoCmd.SetWarnings True ' Turns the warning message setting back on
DoCmd.Close acForm, Me.Name
Exit_cmdDelete_Click:
Exit Sub
Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click
End Sub
After the line "DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
" I get this error: "You entered an expression that has an invalid reference
to the property |."
What is this error and how can I fix it?
Any help is appreciated.
Thanks