J
Jey
HI,
I'm programming tools (in VBA) for importing GPS collar data etc from excel
to access. So far the tool:
1) opens the excel workbook,
2) loops through all of the data to make sure it's valid for the fields it's
destined to go into
3) copies it as values to a new worksheet (many fields are calculated)
4) defines a named region to encompas the data
5) imports it using DoCmd.TransferSpreadsheet ac Import...
My question is in regards to dates. I check for valid dates (if IsDate(....)
then blah blah blah...) which is all well and good, but I also need to find
out if the date is in dd/mm/yyyy or mm/dd/yyyy format...
The destination date field displays as dd/mm/yyyy. If the imported date is
already dd/mm/yyyy, or is written long form (ex either July 4, 2008 or 4
july, 2008), or is mm/dd/yyyy where the day is > 12 then there are no
problems.
The problem occurs when the incoming date is mm/dd/yyyy and the day/month is
ambinguous... the day & month don't get switched, and july 4th becomes april
7th.
I've got warning to the user that they must enter dates as dd/mm/yyyy, and
warnings that they should check the records created inthe database... but for
the GPS data imports in particular the incoming excel worksheets can have
10's of thousands of records. Too many to manually check. I'd rather make it
foolproof!
Is there a way of checking for dd/mm/yyyy vs mm/dd/yyyy when the dates could
be coming from any manner of excel cell formats (text, date, general, who
knows what else). Is there a way of forcing same data into dd/mm/yyyy before
importing (in excel) or during the import process?
Thanks in advance for any suggestions!
Jey
I'm programming tools (in VBA) for importing GPS collar data etc from excel
to access. So far the tool:
1) opens the excel workbook,
2) loops through all of the data to make sure it's valid for the fields it's
destined to go into
3) copies it as values to a new worksheet (many fields are calculated)
4) defines a named region to encompas the data
5) imports it using DoCmd.TransferSpreadsheet ac Import...
My question is in regards to dates. I check for valid dates (if IsDate(....)
then blah blah blah...) which is all well and good, but I also need to find
out if the date is in dd/mm/yyyy or mm/dd/yyyy format...
The destination date field displays as dd/mm/yyyy. If the imported date is
already dd/mm/yyyy, or is written long form (ex either July 4, 2008 or 4
july, 2008), or is mm/dd/yyyy where the day is > 12 then there are no
problems.
The problem occurs when the incoming date is mm/dd/yyyy and the day/month is
ambinguous... the day & month don't get switched, and july 4th becomes april
7th.
I've got warning to the user that they must enter dates as dd/mm/yyyy, and
warnings that they should check the records created inthe database... but for
the GPS data imports in particular the incoming excel worksheets can have
10's of thousands of records. Too many to manually check. I'd rather make it
foolproof!
Is there a way of checking for dd/mm/yyyy vs mm/dd/yyyy when the dates could
be coming from any manner of excel cell formats (text, date, general, who
knows what else). Is there a way of forcing same data into dd/mm/yyyy before
importing (in excel) or during the import process?
Thanks in advance for any suggestions!
Jey