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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set smalldatetime field to empty in VBA

Status
Not open for further replies.

Buster49

Programmer
Oct 27, 2003
9
GB
How do I set a field of type "smalldatetime" in an SQL Server database to be null using VBA?

I've tried the following:

tempDate = GetDateField(301)
Debug.Print "DateUpd="; tempDate
rs!DateUpd = tempDate

GetDateField returns the 10 characters from an input string starting at column 301. If they are all blank then the function sets the return value to empty. When tempDate is empty it prints out as "00:00:00" and an Invalid Date/Time format message arises. If I set the type of the field in the database to "datetime" it all works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top