Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving empty Date data type to table problem

Status
Not open for further replies.

sisan

Programmer
Jan 9, 2002
39
ID
Help me, please

I have a problem to save the Date data type if it is empty.
Say I have a textbox to input date. I can save to disk if there is a data in it, by :

rsTable!InputDate = txtInputDate

But if the textbox is empty, an error 'Type mismatch' will appear.
How can I do it without an error ? (Don't suggest me to assign 'On Error Resume Next'. :)

Thank you
 

Sisan:

Use a variant data type and set its value based on what has been entered by the user.

Dim vDate As Variant

If IsDate(Me.txtInputDate) = True Then

vDate = Me.txtInputDate

Else

vDate = Null

End If

rsTable!InputDate = vDate
 
I wouldn't us a varinat, but istead use the specific type of variable needed. [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top