I have this situation. I am Currently using this code to force data entry in a required field in a form. This works fine, but now the problem I am running into is when I click on the Exit Button. This is the Code:
Private Sub CODREN_LostFocus()
If CODREN.Text = "" Then
MsgBox "Please provide the Contract Number to continue", vbOKOnly, "Warning"
Flag = True
Flag = False
Then in the Next field I use this:
Private Sub RENREN_GotFocus()
If Flag = True Then
Now, when I click in the Button to exit the form, the Message "Please provide the Contract Number to continue" shows up, and then after I click Ok the form closes. I would like to prevent this from happening. I was trying to introduce another If statement in the code where if the Exit button was click it would ignore the message, but I wasn't able to do it. Any help would be highly appreciated.
Thanks in advance.