SteveL13
asked on
How give user an opportunity to exit a form
I have a form with one required field (in the table setup). And I have the following code in the onclose event of the form. But I want to give the user the opportunity to exit the form with no data entry if they want to do so. Here is my code so far:
Private Sub Form_Close()
If Nz(Me.txtCompanyName, "") = "" Then
MsgBox "You must enter a company name!!!"
Exit Sub
End If
End Sub
How can I present them with a message box that will either let them stay in the form but return the focus to the txtCompanyName field, OR, let them leave the form with no data entry?
Private Sub Form_Close()
If Nz(Me.txtCompanyName, "") = "" Then
MsgBox "You must enter a company name!!!"
Exit Sub
End If
End Sub
How can I present them with a message box that will either let them stay in the form but return the focus to the txtCompanyName field, OR, let them leave the form with no data entry?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.