L
LJgrnl
I have a form that asked for the location of an excel workbook, then imports
the
information from three worksheets in the file into three existing tables.
For each worksheet, I make an OLE DB connection to the spreadsheet file and
select preset named ranges in each worksheet, loop through the records and
import only the rows I want using docmd.runsql to do an insert statement.
Each sheet contains dates. I've dim-ed a variable of type date for each
date to be imported. My syntax for assigning the values in each case is:
If Not IsNull(rsXL.Fields(7).Value) Then FollowupDate =
CDate(rsXL.Fields(7).Value)
From one sheet, the dates are imported as date serials (eg: FollowupDate is
38414). From the other two sheets the dates are imported as regular dates
(eg: FollowupDate is 2/2/2005). In the excel spreadsheet, the columns
containing dates are all formatted to be date columns.
How can I force Access/Excel view all dates in a consistent manner? The way
the date is formatted affects the insert sql statement.
I'm using Access 2003 and Excel 2003, tho potentially will also use this to
import Excel2000 and 97 workbooks.
Thanks for your help.
the
information from three worksheets in the file into three existing tables.
For each worksheet, I make an OLE DB connection to the spreadsheet file and
select preset named ranges in each worksheet, loop through the records and
import only the rows I want using docmd.runsql to do an insert statement.
Each sheet contains dates. I've dim-ed a variable of type date for each
date to be imported. My syntax for assigning the values in each case is:
If Not IsNull(rsXL.Fields(7).Value) Then FollowupDate =
CDate(rsXL.Fields(7).Value)
From one sheet, the dates are imported as date serials (eg: FollowupDate is
38414). From the other two sheets the dates are imported as regular dates
(eg: FollowupDate is 2/2/2005). In the excel spreadsheet, the columns
containing dates are all formatted to be date columns.
How can I force Access/Excel view all dates in a consistent manner? The way
the date is formatted affects the insert sql statement.
I'm using Access 2003 and Excel 2003, tho potentially will also use this to
import Excel2000 and 97 workbooks.
Thanks for your help.