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

Date Insert results in erroneous date

Status
Not open for further replies.

JakeNL

Technical User
Jan 30, 2002
5
NL
I Have a huge problem trying to insert a date in a date/time field of a jet db.
Firstly I create a SQL string to perform the operation and later on I execute this SQL string on the connection. Afterwards some very weird data can be found in the real field if I look in it with the Visual data Manager. I use VB6 (SP5). Also tried the constant in between accents '10920' but same result.



Private Sub CreateInsertstring()
Dim datum As Date
datum = Date
sSQL = "INSERT INTO tbl_abon (passnumber,ending) VALUES (10920, " & datum & ")"
End Sub


run on : 8 of june 2004
result in date/time field (Short Date): 7-7-1894

Looks super odd to me any help would be very much welcomed.

Jack
 
Try this

sSQL = "INSERT INTO tbl_abon (passnumber,ending) VALUES (10920, #" & datum & "#)"

David Paulson

 
Yep,

That works resulting in m-d-y correctly and that also triggered some other tries, now i also tried to put the date inbetween accents and that had not yet occurred to me before. So problem solved

Thanks David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top