PDA

Click to See Complete Forum and Search --> : Date fields


pookie62
Mar 16th, 2005, 03:25 AM
Hi,
As you can read in this (http://www.vbforums.com/showthread.php?t=327537) post, I am importing data form Excel into MSAccess through VBA code.
The strange thing is that in MS db the date field is default : 16-4-2005 10:15:25
(Time is not visible in the forms)
In the xls sheet the column with dates has the propertie dd-mm-yyyy
So I changed in MS db the data field to dd-mm-yyyy
But after importing all dates are :30-12-1899
What's wrong ??

laisengchew
Mar 16th, 2005, 03:40 AM
May be you can try to put a string to catch all the data in excel column and then format it before you export to mdb

Dim strDate As String
strDate = Cells(Row, Column).Value
strDate = Format$(Date, "dd/mm/yyyy")

pookie62
Mar 16th, 2005, 04:35 AM
Hi laisengchew,
Thanks for replying.

Tried it and getting errors that Row isn't defined..

What is the difference with my code ?
With xlsheet
.range("C:C").NumberFormat = "dd-mm-yyyy"
End With