Combobox cboSPECIFICISSUE
If the user ties to close the form using the CLOSE FORM button and the cboSPECIFICISSUE is null, I want a message box "MISSING DATA" and set focus back to the combobox.
I am receiving the Object required error.
Here are 2 versions of the code:
Code: Select all
Private Sub cmd_CloseForm_Click()
On Error GoTo Err_cmd_CloseForm_Click
If Me.cboSPECIFIC_ISSUE Is Null Then
MsgBox "Please fill in SPECIFIC ISSUE", vbInformation, "MISSING DATA"
Me.cboSPECIFIC_ISSUE.SetFocus
End If
DoCmd.Close
Exit_cmd_CloseForm_Click:
Exit Sub
Err_cmd_CloseForm_Click:
MsgBox Err.Description
Resume Exit_cmd_CloseForm_Click
End Sub
Code: Select all
Private Sub cmd_CloseForm_Click()
On Error GoTo Err_cmd_CloseForm_Click
If Me.cboSPECIFIC_ISSUE Is Null Then
MsgBox "Please fill in SPECIFIC ISSUE", vbInformation, "MISSING DATA"
Me.cboSPECIFIC_ISSUE.SetFocus
Else
DoCmd.Close
End If
Exit_cmd_CloseForm_Click:
Exit Sub
Err_cmd_CloseForm_Click:
MsgBox Err.Description
Resume Exit_cmd_CloseForm_Click
End Sub
I have been doing this for 20 years and just get a brain lock every so often. This is one of those times.