Insert query writing time to date field (1 Viewer)

grahma_aiken

Registered User.
Local time
Today, 08:37
Joined
Apr 18, 2012
Messages
10
Hi, first post - please be kind.

I have an insert query that looks like this:

DoCmd.RunSQL ("INSERT INTO DocTable ( FileID, DocType, DocTitle, DocStatus, DocSequence, DocCreationDate, DocCreationUser ) " & _
"SELECT " & intFileID & ", " & intDocType & ", " & Title & ", " & intStatus & ", " & intSequence & ", " & Date & ", " & intUser & ";")

Everything about this query works EXCEPT Date is not being written to the record - a time is and it isn't even the system time. I've used Date() a hundred times over in other queries and modules and haven't had this problem. Any ideas?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:37
Joined
Aug 30, 2003
Messages
36,130
Try

"SELECT " & intFileID & ", " & intDocType & ", " & Title & ", " & intStatus & ", " & intSequence & ", #" & Date & "#, " & intUser & ";")
 

grahma_aiken

Registered User.
Local time
Today, 08:37
Joined
Apr 18, 2012
Messages
10
That worked. I cannot believe I didn't think of that. Thank you so much.:D
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:37
Joined
Aug 30, 2003
Messages
36,130
Happy to help, and welcome to the site!
 

Users who are viewing this thread

Top Bottom