Hi,

I am just learning VB. I am trying to get this code to work:


Private Sub txtDateOff_LostFocus()
If txtDateOff.Text = Format(txtDateOff, "dd/mm/yy") Then
Exit Sub
Else
txtDateOff.Text = ""
MsgBox "Please enter Date in dd/mm/yy format. For example, 08/25/02."
End If
End Sub

As you can probably see I am trying to have the user enter a date in a textbox and then only allow it to "stick" (and be submitted to the database) if they get the dd/mm/yy format right. Only problem is I can't get it right: When I type in, say, 08/25/01 or anything else, I get the "Pleas enter date" msgbox. I might have the FORMAT syntax wrong. Thanks a bunch for your help.
Nick