bodylojohn
Registered User.
- Local time
- Today, 17:31
- Joined
- Dec 28, 2005
- Messages
- 205
Hello,
I have an unbound form that I use for searches.
On that form I have a datefield called "txtDatumVan".
I have written some code to check if the user filled in a date.
This is the following code:
This code works perfect.
However dit I adjust the property "format" of this textbox to shortdate so a datepicker appears when the tekstbox gets the focus.
Lets say I type in an "a" instead of a date I get an Office warning that I cannot input a letter but that it has to be a date.
Before I adjusted the format I got my own error message that you see in the code.
I tried docmd.setwarnings = false but without success.
What am I doing wrong???
I have an unbound form that I use for searches.
On that form I have a datefield called "txtDatumVan".
I have written some code to check if the user filled in a date.
This is the following code:
Code:
Private Sub txtDatumVan_LostFocus()
'DoCmd.SetWarnings = False
If Me.txtDatumVan = "" Or IsNull(Me.txtDatumVan) Then
Exit Sub
Else
If IsDate(Me.txtDatumVan) Then
Else
MsgBox ("Vul een datum in of kies deze uit de kalender!")
Me.txtNaamMedewerker.SetFocus
Me.txtDatumVan.SetFocus
End If
End If
'DoCmd.SetWarnings = True
End Sub
This code works perfect.
However dit I adjust the property "format" of this textbox to shortdate so a datepicker appears when the tekstbox gets the focus.
Lets say I type in an "a" instead of a date I get an Office warning that I cannot input a letter but that it has to be a date.
Before I adjusted the format I got my own error message that you see in the code.
I tried docmd.setwarnings = false but without success.
What am I doing wrong???