I can't seem to get dates imported from an Excel file to store and write to a new table properly.
Here is an excerpt from my code. The date imports correctly to my tblAll but then seems to convert the values in the tblResults. Any assistance would be greatly appreciated.
tblAll
tblResults
Why are they coming up 1899?
Thanks for any help.
cb
Here is an excerpt from my code. The date imports correctly to my tblAll but then seems to convert the values in the tblResults. Any assistance would be greatly appreciated.
Code:
Dim bTickDate As Date
Dim rs As ADOR.Recordset
Set rs = New ADOR.Recordset
rs.ActiveConnection = CurrentProject.Connection
rs.CursorType = adOpenStatic
DoCmd.RunSQL "CREATE TABLE tblResults (ID Long, bTickDate Date)"
rs.Open "Select * from tblAll"
‘ read a date from the table
bTickDate = rs!TickDate
'write record to tblResults
DoCmd.RunSQL "INSERT INTO tblResults (ID, bTickDate) VALUES (" & ID & ", " & bTickDate & ")"
Code:
TickDate 1/2/2001 1/3/2001 1/4/2001 1/5/2001
Code:
bTickDate 12/30/1899 12/30/1899 12/30/1899 12/30/1899
Thanks for any help.
cb
Comment