C
CJ
Hi groupies.
If a subform contains data I want a message box to pop up and tell the user
that they can not delete the customer (instead of the default access
message) when they click on the delete customer button. I can't seem to get
the test for the data in the subform to work properly.
My code is as follows:
Private Sub cmdCustomerDelete_Click()
On Error GoTo Err_cmdCustomerDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
If IsNull(Me![fsubOrders].Form![dtmOrderDate] = False) Then
MsgBox "Can Not Delete Customer With Orders In The System",
vbCritical"
End If
Exit_cmdCustomerDelete_Click:
Exit Sub
Err_cmdCustomerDelete_Click:
MsgBox "Deletion Cancelled", vbInformation"
Resume Exit_cmdCustomerDelete_Click
End Sub
My "Deletion Cancelled" message box works, but not "Can Not Delete
Customer..."
Can somebody please help me out.
Thanks
If a subform contains data I want a message box to pop up and tell the user
that they can not delete the customer (instead of the default access
message) when they click on the delete customer button. I can't seem to get
the test for the data in the subform to work properly.
My code is as follows:
Private Sub cmdCustomerDelete_Click()
On Error GoTo Err_cmdCustomerDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
If IsNull(Me![fsubOrders].Form![dtmOrderDate] = False) Then
MsgBox "Can Not Delete Customer With Orders In The System",
vbCritical"
End If
Exit_cmdCustomerDelete_Click:
Exit Sub
Err_cmdCustomerDelete_Click:
MsgBox "Deletion Cancelled", vbInformation"
Resume Exit_cmdCustomerDelete_Click
End Sub
My "Deletion Cancelled" message box works, but not "Can Not Delete
Customer..."
Can somebody please help me out.
Thanks