F
fredg
I have a Textbox with a number in it.
042707
I need to convert this number to a date 04/27/07 and then compare it to the
current date to see if it matches
If Me.TxtNumber = Date() Then
MsgBox "Matches"
ElseIf Me.TxtNumber <> Date() Then
MsgBox "No Match"
End If
Any help is appreciated.
Thanks
DS
So 042707 is text datatype?
If DateSerial(Right([txtNumber],2), Left([TxtNumber],2),
Mid([txtNumber],3,2) = Date() Then
MsgBox "Matches"
Else
MsgBox "Does NOT match"
End If
No need for Elseif if there is only 2 possiblities.
Look up the DateSerial function in VBA help.