G
Guest
I searched the forum and found a code to keep users from closing a form if
they had not filled in a required field. My problem is, the form closes
anyway instead of staying open so they can fill in the field.
Here's the code....what am I doing wrong?
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me!subfrmUpdateQ!cbxReason) Then
Cancel = True ' cancel update
MsgBox "You must select a Reason/Note.", _
vbOKCancel, "Required Field"
Me!subfrmUpdateQ!cbxReason.SetFocus
End If
End Sub
they had not filled in a required field. My problem is, the form closes
anyway instead of staying open so they can fill in the field.
Here's the code....what am I doing wrong?
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me!subfrmUpdateQ!cbxReason) Then
Cancel = True ' cancel update
MsgBox "You must select a Reason/Note.", _
vbOKCancel, "Required Field"
Me!subfrmUpdateQ!cbxReason.SetFocus
End If
End Sub