I have the following function:
What this does is test to see whether or not CaseID contains a value. If it does not, this means that the parent table has no record in it and someone is attempting to add a record into this table without a parent record to tie it to...which is bad.
Now, the code above works to cancel any changes that were made before they create a record in the database. However, as you can see from my Msgbox statement, it does not clear the information from the form and I am forced to then ask them to hit the Esc button to actually clear the form contents.
I want to change this to an OkayCancel Msgbox that performs the same function as hitting the Esc key to truly cancel the changes and reset the form contents...I'm not sure if this is possible, but thanks in advance for any replies!
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If (IsNull(Me.CaseID) = True) Then
Msgbox "This Subcase record is not tied to a valid Master Case record. Please cancel your changes by hitting Escape.", vbOKOnly, "ERROR"
Cancel = True
Exit Sub
End If
End Sub
Now, the code above works to cancel any changes that were made before they create a record in the database. However, as you can see from my Msgbox statement, it does not clear the information from the form and I am forced to then ask them to hit the Esc button to actually clear the form contents.
I want to change this to an OkayCancel Msgbox that performs the same function as hitting the Esc key to truly cancel the changes and reset the form contents...I'm not sure if this is possible, but thanks in advance for any replies!