Pulling a date from a textbox: Run Time Error "13" (1 Viewer)

alktrigger

Aimless Extraordinaire
Local time
Today, 07:07
Joined
Jun 9, 2009
Messages
124
I have a form with a textbox "txtDateSent". To help speed up some code/queries, I have created a function "DateGrab()" which reads that text box for the date value (from a datepicker). For some reason it is giving me RTE-13 - 'Type Mismatch'. I think it might have to do with the fact that I am trying to turn a string into a date without a special function. If so, what function am I missing?

Code:
Public Function DateGrab() As Date
    DateGrab = [Forms]![frmSpecificAdd].[txtDateSent]
End Function
 

boblarson

Smeghead
Local time
Today, 04:07
Joined
Jan 12, 2001
Messages
32,059
You could try using

CDate

but are you sure it isn't null or an empty string when you are referring to it?
 

Users who are viewing this thread

Top Bottom