Importing into Access

chrisguk

Registered User.
Local time
Today, 14:42
Joined
Mar 9, 2011
Messages
148
Hi,

I am using the following code to import my spreadsheet into Access but I have a split database main.adb and main_be.mdb. How can I modify this code to put the data into the linked table?

Code:
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel7, "tblCustomerDetails", "myfile.xls", False,

Sorry to add to that. What is the file name is not all the same, how can I dynamically select my file?
 
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9,
"MyTable", "C:\MyFile.xls", True

Reminder: TRUE means "tell Access that the first row is column
headings, so don't import the column headings.

Dim MyXLFileName as String
{ your code that assigns the varable MyXLFileName as a string }
example: MyXLFileName = "myfile.xls" ' use an input box (worst case) or some interface for the user to select a valid Excel file name (best case).
..., "myfile.xls", False becomes--> ..., MyXLFileName, False
 
If you use linked tables your data will be imported into the linked ones
 
If you use linked tables your data will be imported into the linked ones


I got the linked table situation sorted, that was just a typo so the program created its own table.

For the imprt i was hoping there was a solution available to open a windows dialogue like you do in explorer and select the file to import?
 
I got the linked table situation sorted, that was just a typo so the program created its own table.

For the imprt i was hoping there was a solution available to open a windows dialogue like you do in explorer and select the file to import?
It's possible, but involve more coding ;)
do a search for Browse in the forums
 

Users who are viewing this thread

Back
Top Bottom