What's wrong?

Can anybody, for god's sake, tell me what's wrong with this fragment:

Dim DateToday As Date
Private Sub Command1_Click()
DateToday = Date
DateToday = Format(Date, "Long Date")
Me.Print DateToday
End Sub

Because I have used it and VB kept giving a type mismatch error message.

Please help me with this because I am about to go crazy!!
mhdhallakAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
VbmasterConnect With a Mentor Commented:
The helpfile says

"Format Function

Returns a Variant (String) containing an expression formatted according to instructions contained in a format expression."

You try to assign the value to a variable of type DATE. Try declaring the DateToday variables as STRING and it will work.
0
All Courses

From novice to tech pro — start learning today.