M
magmike
I have a field that I want to ensure is not forgotten on a form's
close after new record is created.
I have used the following code on a forms Close Buttons OnClick event,
and I did something wrong! Help me figure it out if you have a minute.
Thanks - the code:
Private Sub Close_Click()
On Error GoTo Err_Close_Click
Dim stMessage As String
Dim cmdClose As String
stMessage = "Choose Male or Female"
cmdClose = "DoCmd.Close"
IIf ContactGender Is Not Null, cmdClose, MsgBox(stMessage)
Exit_Close_Click:
Exit Sub
Err_Close_Click:
MsgBox Err.Description
Resume Exit_Close_Click
End Sub
When I click the close button, regardless of whether the field is null
or not, it displays the message, then a second one that says, Object
Required.
Thanks in advance!
magmike7
close after new record is created.
I have used the following code on a forms Close Buttons OnClick event,
and I did something wrong! Help me figure it out if you have a minute.
Thanks - the code:
Private Sub Close_Click()
On Error GoTo Err_Close_Click
Dim stMessage As String
Dim cmdClose As String
stMessage = "Choose Male or Female"
cmdClose = "DoCmd.Close"
IIf ContactGender Is Not Null, cmdClose, MsgBox(stMessage)
Exit_Close_Click:
Exit Sub
Err_Close_Click:
MsgBox Err.Description
Resume Exit_Close_Click
End Sub
When I click the close button, regardless of whether the field is null
or not, it displays the message, then a second one that says, Object
Required.
Thanks in advance!
magmike7