D
DWL
I am working with a form that has tab controls. I code for the
required fields that if null will give the user a message. I also have
code when leaving the form to run a delete query that deletes the
record if the required field is null. The problem I am having is with
the two required fields that are dates. When creating a new record,
when the form is loaded, even before the user can begin entry, the
message box pops up. It doesn't do this for the fields that are not
dates. Below is my code. The date field is on the third tab and the
form sets focus to the project number on the first tab when the form
opens.
Private Sub Plans_Approved_Exit(Cancel As Integer)
If IsNull(Plans_Approved) Then
MsgBox ("The plans approved date is a required field.")
'This message comes up at beginning of form even if not on this
sheet tab
Cancel = True
End If
End Sub
This is the same code I am using for text fields that are null. Should
dates be handled differently? I don't want the message to appear until
the user has left the field.
required fields that if null will give the user a message. I also have
code when leaving the form to run a delete query that deletes the
record if the required field is null. The problem I am having is with
the two required fields that are dates. When creating a new record,
when the form is loaded, even before the user can begin entry, the
message box pops up. It doesn't do this for the fields that are not
dates. Below is my code. The date field is on the third tab and the
form sets focus to the project number on the first tab when the form
opens.
Private Sub Plans_Approved_Exit(Cancel As Integer)
If IsNull(Plans_Approved) Then
MsgBox ("The plans approved date is a required field.")
'This message comes up at beginning of form even if not on this
sheet tab
Cancel = True
End If
End Sub
This is the same code I am using for text fields that are null. Should
dates be handled differently? I don't want the message to appear until
the user has left the field.