Sunday, August 2, 2009

Error 80040e37: Inserting to Excel from Access ADO and VBA?

I'm getting a runtime error when I try to insert the contents of MyTable to an Excel spreadsheet.





"The Microsoft Jet database engine could not find the object 'MyTable'. Make sure the object exists, and you spell it's name and the path name correctly."





The full string at runtime reads:


SELECT MyTable.* INTO [Excel 8.0;Database=


C:\Documents and Settings\solly\My Documents\arf.xls].


[Sheet2] FROM MyTable





If I try to write a hard-coded string to the spreadsheet, it works. It fails when it tries to fetch the data from the source, which is a table in the .mdb that hosts the code I'm writing. The name IS spelled correctly.

Error 80040e37: Inserting to Excel from Access ADO and VBA?
i havent tried this before, and the fact that tou got this to work is confusing...this will make my answer incorrect.


but here goes anyway.





isnt the SELECT statement supposed to retrieve your columns?


maybe you can try SELECT (one column name)...its possible you have a column called MyTable within your MyTable database.





or even SELECT *





the * should select all columns.





im all out of ideas.
Reply:Im a little not used to excel quite yet but can't you go in to the computer and just turn off the runtime error reporting?


No comments:

Post a Comment