Export Excel Data Into Access Via DBO

mosh

Registered User.
Local time
Today, 11:31
Joined
Aug 22, 2005
Messages
133
All,

I am trying to export excel data into an access table via a command button.

This is the code I have so far in excel;

Private Sub CommandButton1_Click()

Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\temp\test.mdb;"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Table1", "C:\sr.xls", True, "A1:B3"
End Sub



But i get a run time error 424, Object required. I am running office 2003, i think the reason why it's not working is because I haven't referenced the correct ADO library?

Help please.

Thanks
________
Avandia lawsuit
 
Last edited:

Users who are viewing this thread

Back
Top Bottom