Editing Input from a TransferSpreadsheet command
Posted on 2012-12-31
One of my clients is receving data from a business partner on a spreadhseet. I have no say or control over this, it is a given.
The first part of my app pops a file selection dialog that they use to select the spreadsheet to be imported. All spreadhseets should have the same number of columns and column attributes (date, numeric, text etc..)
As a result of my transferspreadsheet command, a table is created in my MDB. I am trying to develop edit routines to run on the imported data.
Specifically I am want to edit a field that should contain a valid date. I would like to point the client to any problem records as specifically as possible.
On the example spreadsheet the column 'DateOfOrder' is formatted as a date. The contents of the first 3 rows of this column on the spreadhseet are valid dates, the 'DateOfOrder' cell on the 4th record contains the word "test". apparently Excel doesn't make you enter a date into a cell formatted as date.
When the new table is created as a result of the transferspreadsheet, the column "DateOfOrder' is set to type 'Text'. The valid dates of the first three records appear as numbers (41278, 41278, 41281) instead of dates.
The issue: Becuase of the column was imported as 'Text', even though only row 4 contains an invalid date, none of the first 3 columns are vaild dates either.
My edits would show "invalid date" errors on all 4 rows, when in reality only the fourth row is wrong. This would be confusing to the client trying to research and correct any errors.
I am used to using import specs when importing comma delimited data to control the format that a particular column is imported as. There is no such option, or at least none that I know of in the 'TrasnferSpreadsheet command.
Is there any solution to how this is being imported so I can be more specific in my edits to the client? In reality the spreadsheets will contain hundreds of rows. Telling the client that there is a date error 'somewhere' in first column without pointing them to the specific record would be just about worthless as far as helping them resolve the error.
Is there a different approach I can take to accomplish my objective of specifically pointing the client to invalid data?