rhonda6373
Registered User.
- Local time
- Today, 11:51
- Joined
- Jun 14, 2015
- Messages
- 22
I have an option group (optResponse31) that has 3 buttons. I want a message to pop up when the user clicks on the form by clicking the X on the top right of the form. I want the message to state "Please enter a value." if no value is entered.
I tried to set the required property in the table to Yes and that did not work. I also tried the following code. The code makes the message pop up if a value is entered or not and when you click OK on the message it closes the form anyway.
What am I doing wrong? Thanks!
I tried to set the required property in the table to Yes and that did not work. I also tried the following code. The code makes the message pop up if a value is entered or not and when you click OK on the message it closes the form anyway.
What am I doing wrong? Thanks!
Code:
Private Sub Form_Close()
'check for required fields
If IsNull(Me.optResponse31) = True Then
MsgBox "Please enter a response."
Me.optResponse31.SetFocus
Else
'Close the form.
DoCmd.Close
End If
End Sub