SQL returns time.. not date (1 Viewer)

Shaunk23

Registered User.
Local time
Yesterday, 20:44
Joined
Mar 15, 2012
Messages
118
having an issue with the below.. the debug shows fine! The fields it being put into is formatted as "mm/dd/yy" in the table & the textbox on the front end is the same...

The debug shows:
INSERT INTO [SubQuote] (QuoteID,TYPEOFQUOTE, Quantity, CargoType,CargoDescription,QuoteLen, QuoteWid, QuoteHgt, QuoteWgt, SubNotes,Datecreated, QuoteCuft,Exclude) SELECT 4867 As QuoteID, TYPEOFQUOTE, Quantity, CargoType, CargoDescription, QuoteLen, QuoteWid, QuoteHgt, QuoteWgt, SubNotes,6/14/2012 as Datecreated, QuoteCuft,Exclude FROM SubQuote WHERE (QuoteID = 4866);





The Table shows:
12/30/1899 And upon click shows 12:00:18 AM - A listbox that has that field in it shows 12:00:18 AM.




The code is :

SubQuoteSQL = " INSERT INTO [SubQuote]" & _
" (QuoteID,TYPEOFQUOTE, Quantity, " & _
" CargoType,CargoDescription,QuoteLen, QuoteWid, QuoteHgt, QuoteWgt, " & _
" SubNotes,Datecreated, QuoteCuft,Exclude)" & _
" SELECT " & LongNewID & " As QuoteID, TYPEOFQUOTE, Quantity, CargoType, CargoDescription, " & _
" QuoteLen, QuoteWid, QuoteHgt, QuoteWgt, SubNotes," & TodayDate & " as Datecreated, QuoteCuft,Exclude" & _
" FROM SubQuote " & _
" WHERE (QuoteID = " & IdToCopy & ");"
'Debug.Print SubQuoteSQL
DB.Execute (SubQuoteSQL), dbFailOnError
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:44
Joined
Aug 30, 2003
Messages
36,140
Date fields need to be surrounded by #, or you can use the Date() function in the SQL (without concatenating).
 

Users who are viewing this thread

Top Bottom