I have just about finished adding a module to my database to import information from an Excel spreadsheet into the appropriate table. It successfully creates some temporary tables, performs DoCmd.TransferS preadsheet, formats and manipulates the records, does some checks against existing data and then writes to the table.
However, I started testing it with some realistic scenarios and it has broken big-time in one puzzling fashion.
The spreadsheet being imported is a list of assessment criteria for a given building, which is filled out by a roving interviewer. One column (D) is devoted to coded short responses (e.g., 'Y' 'N' etc), which is where Access comes in handy, and that's going perfectly now. Another column (F) has interviewer's comments and goes to a memo field, which seems fine.
But the third column that the interviewer is supposed to complete, for freeform responses (E), is only importing successfully under very strange circumstances. I tried entering a long string of nonsense text--initially this was to check how the corresponding form textbox would display it if the interviewer got carried away. I placed the string into two of the freeform cells and their corresponding comment cells. Suddenly errors started being generated on import. Rather than truncate the strings, Access was rejecting them altogether and leaving the values as null. There's no warning so I only noticed when a dozen import error tables had piled up from my tests...
This is the structure of the first temporary table. Importing to it is when the error table is generated:
The content of _ImportErrors is invariably:
The really weird thing is that this only happens if both of the comment fields are too long. If they are both too long, they both fail. If either of them is less than 255 characters, neither of them fails (the long one is truncated instead).
Changing the field type of [F5] to memo doesn't help, which truly worries me.
I could programmaticall y truncate the string before moving it into the final table, but since this problem occurs during TransferSpreads heet, I don't have very fine control.
Any ideas? Is this a problem with my code or with the Excel workbook?
However, I started testing it with some realistic scenarios and it has broken big-time in one puzzling fashion.
The spreadsheet being imported is a list of assessment criteria for a given building, which is filled out by a roving interviewer. One column (D) is devoted to coded short responses (e.g., 'Y' 'N' etc), which is where Access comes in handy, and that's going perfectly now. Another column (F) has interviewer's comments and goes to a memo field, which seems fine.
But the third column that the interviewer is supposed to complete, for freeform responses (E), is only importing successfully under very strange circumstances. I tried entering a long string of nonsense text--initially this was to check how the corresponding form textbox would display it if the interviewer got carried away. I placed the string into two of the freeform cells and their corresponding comment cells. Suddenly errors started being generated on import. Rather than truncate the strings, Access was rejecting them altogether and leaving the values as null. There's no warning so I only noticed when a dozen import error tables had piled up from my tests...
This is the structure of the first temporary table. Importing to it is when the error table is generated:
Code:
F1 Long Integer F2 Text (5) F3 Text (60) F4 Text (10) F5 Text (255) F6 Memo AImportIndex AutoNumber / Primary Key
The content of _ImportErrors is invariably:
Code:
Error Field Row Type Conversion Failure F5 7 Type Conversion Failure F5 9
Changing the field type of [F5] to memo doesn't help, which truly worries me.
I could programmaticall y truncate the string before moving it into the final table, but since this problem occurs during TransferSpreads heet, I don't have very fine control.
Any ideas? Is this a problem with my code or with the Excel workbook?
Comment