cyberman55
Registered User.
- Local time
- Today, 07:23
- Joined
- Sep 22, 2012
- Messages
- 83
This is an oddball. I have to import 255 fields (1 record) from an Excel spreadsheet. So, naturally, I used the docmd.TransferSpreadsheet command. I've used it many times in the past, but never for more than 20 fields or so. With this many fields, it failed, usually around column 117 and/or intermittently beyond that so the incoming data was spotty and incomplete. I could not find any documentation on some kind of bug. The errors table listed "Row Truncation" on all the problem fields. But none of the data had more than 60 characters and I am dumping the data into a table with all fields defined as Short Text.
So, I decided to see if I could bring in the data in smaller chunks or 52-70 columns at a time. And it worked! This proved to me that there was nothing wrong with the incoming data.
But running this code:
I ended up with four records in table CopyHere with no values except in the imported range.
So, the challenge (at least for me) is how to collapse all the data into a single record? I can't see an easy way to do it.
Just to clarify something that may be confusing: The tab in the workbook I'm importing is named "CopyHere" and the table I'm importing into is also named "CopyHere" (and yea, I know, bad).
So, I decided to see if I could bring in the data in smaller chunks or 52-70 columns at a time. And it worked! This proved to me that there was nothing wrong with the incoming data.
But running this code:
Code:
strEndRange = "CopyHere!A1:BZ2"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "CopyHere", strWBNameAndPath, -1, strEndRange
strEndRange = "CopyHere!CA1:DZ2"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "CopyHere", strWBNameAndPath, -1, strEndRange
strEndRange = "CopyHere!EA1:FZ2"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "CopyHere", strWBNameAndPath, -1, strEndRange
strEndRange = "CopyHere!GA1:ITZ2"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "CopyHere", strWBNameAndPath, -1, strEndRange
I ended up with four records in table CopyHere with no values except in the imported range.
So, the challenge (at least for me) is how to collapse all the data into a single record? I can't see an easy way to do it.
Just to clarify something that may be confusing: The tab in the workbook I'm importing is named "CopyHere" and the table I'm importing into is also named "CopyHere" (and yea, I know, bad).