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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX component cannot create object "Access.Application"

Status
Not open for further replies.

quesnelljc

Technical User
Nov 4, 2008
6
0
0
GB
I am trying to write some code into a data access page which will export data from an access database.

I am gettinging the error "ActiveX component cannot create object Access.Application" when running the following code:

Dim objAcc
Set objAcc = CreateObject("Access.Application")
objAcc.Visible = False
path = &quot from home\test db connection.mdb"
objAcc.OpenCurrentDatabase path
objAcc.DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "table1", &quot from home\output.xls", True
objAcc.Quit
Set objAcc = Nothing
msgbox "Done"

I have tried running the same piece of code within an access database and it all works as expected so I can't understand why the problem occurs in a data access page.

Any help or support would be much appreciated.
 
No. Not sure why it has put this in. My code is;

Dim objAcc
Set objAcc = CreateObject("Access.Application")
objAcc.Visible = False
path = c:\working from home\test db connection.mdb"
objAcc.OpenCurrentDatabase path
objAcc.DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "table1", C:\working from home\output.xls", True
objAcc.Quit
Set objAcc = Nothing
msgbox "Done"

Not sure how this got in there, but it only appears when the code has been pasted in.
 
should be

Code:
path = [COLOR=red]"[/color]c:\working from home\test db connection.mdb"
objAcc.OpenCurrentDatabase path
objAcc.DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "table1", [COLOR=red]"[/color]C:\working from home\output.xls", True
 
Thanks,

That is what I have got. Just forgot to put the quotes in here.

Still having the same error returned???

It is a real mystery to me!
 
Please...How do I use VB to link to tables in a Microsoft Access MDB file using a IP address?
thanks in advance for any help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top