batwings
Registered User.
- Local time
- Today, 17:10
- Joined
- Nov 4, 2007
- Messages
- 40
Hi there
I have managed to import a spreadsheet from Excel to Access using a command button on a form and adding the code below to the onclick event. And it works well but:-
The spreadsheet table1.xls I use is updated frequently! how do I go about dropping the data in the Access table "Test" but keeping the structure of the table and then re-import new data from spreadsheet table1.xls
Or Append then update although with 24,000 rows and 11 columns it might be quite slow tp try this.
Keeping in mind that in the "Test" table there is an ID field which is the PK so I would probably need to be able to shift the columns along 1 to the right to prevent the new spreadsheet data trying to populate the ID field with the wrong data.
Also there is one new column last on the right that I added to the test "Table" for comments It would be nice to keep but not neccessary.
Private Sub Command0_Click()
DoCmd.TransferSpreadsheet acImport, 8, "Test", "C:\Test\table1.xls", True, " "
End Sub
Regards
Batwings
I have managed to import a spreadsheet from Excel to Access using a command button on a form and adding the code below to the onclick event. And it works well but:-
The spreadsheet table1.xls I use is updated frequently! how do I go about dropping the data in the Access table "Test" but keeping the structure of the table and then re-import new data from spreadsheet table1.xls
Or Append then update although with 24,000 rows and 11 columns it might be quite slow tp try this.
Keeping in mind that in the "Test" table there is an ID field which is the PK so I would probably need to be able to shift the columns along 1 to the right to prevent the new spreadsheet data trying to populate the ID field with the wrong data.
Also there is one new column last on the right that I added to the test "Table" for comments It would be nice to keep but not neccessary.
Private Sub Command0_Click()
DoCmd.TransferSpreadsheet acImport, 8, "Test", "C:\Test\table1.xls", True, " "
End Sub
Regards
Batwings