Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting data form Excel lto Access

Status
Not open for further replies.

coughnut

Programmer
Joined
Dec 6, 2005
Messages
27
Location
US
I am trying to export some data that I have in an excell spread sheet, to a table in access. I am trying to do this in VBA in Access.... I am totally lost, can any one please help me. Thanks...
 
Have you looked at DoCmd.TransferSpreadsheet?
 
NO I have not, but how does this function works. I have never done any VBA before.
 
You could use it in a module, or as a command for a button:
Code:
Sub cmdExport_Click()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Tablename", "C:\Data\TekTips.xls"
End Sub
Just type DoCmd.TransferSpreadsheet and select suitable options from those offered by intellisence.
You could also create a macro: choose TransferSpreadsheet from the drop down list of actions and fill in the required information.
 
Thanks alot I will give that a try...
 
What about if I have a spreadsheet with multiple work books. Let say I want to import Sheet2. Here is how I am doing it: DoCmd.TransferSpreadsheet acImport,
acSpreadsheetTypeExcel9 _
, "theTable", "C:\temp\Test.xls", , "Sheet2"

and I ge the error "Could not find the object 'Sheet2'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top