CraigDouglas
Registered User.
- Local time
- Today, 16:50
- Joined
- Sep 14, 2016
- Messages
- 31
Please can someone help? I have a form frmAddNewCustomer. I have a text box in it called txtCustomerEmail. When the form closes, I want a message to come up if there is no email in the txtCustomerEmail text box. I want to have two options in the msgBox one to cancel the closing of the form if the person forgot to put the email address in. So, they can go and put it in and an option to continue to close the form and go back to the frmOrderForm that will be open as the frmAddNewCustomer opened from the frmOrderForm. The message will be something like click cancel to fill in the email address or click ok to continue. I tried all different things and the best code I could come up with is wrong but I will paste it.
The other problem I have is I already have code in the Close event. I will attach my Database. Craig
The other problem I have is I already have code in the Close event. I will attach my Database. Craig
Code:
On Error GoTo ErrorHandler
If (IsNull(txtCustomerEmail)) Then
Beep
MsgBox "Don't forget email address if possible.", vbOKCancel, "Warning!"
ElseIf vbOK Then
DoCmd.Close
End If
CleanUpAndExit:
Exit Sub
ErrorHandler:
Call MsgBox("An error was encountered" & vbCrLf & vbCrLf & _
"Description: " & Err.Description & vbCrLf & _
"Error Number: " & Err.Number, , "Error")
Resume CleanUpAndExit