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

OutputTo command can't see report during export from Access

Status
Not open for further replies.

paulfla

Programmer
Apr 22, 2002
29
US
I would appreciate your help. I'm using VB6 with Access 2002 on Win 2k

I want to automatically export a report from Access 2002 as an excel file. Iwant to call the VB exe from the Task Scheduler. When I run the Visual Basic 6 code is says

Runtime error '3011'
The Microsoft Jet Database engine could not find the Object "Inventory_rpt_HCPG" in the database.


The database is opening and I do see the specified report, but for some reason VB can not see the report in the access db.

I would really appreciate your help. Thank you in advance for your time.




============
Private Sub Form_Load()

Dim objAccess As Object
Dim strrptname
strrptname = "Inventory_rpt_HCPG"
acformatXLS = "Microsoft Excel 97-2002 (*.xls)"

Set objAccess = CreateObject("Access.Application")
objAccess.Visible = False
objAccess.OpenCurrentDatabase ("I:\
'Export access report to Excel .xls format
objAccess.docmd.OutputTo acOutputReport, strrptname, acformatXLS, "c:\Inetpub\ False


objAccess.quit acexit

End Sub
============
 
Why don´t you simply create a macro in Access "Export", step1: "OutputTo" ... put in the parameters.

step2: Exit or Quit (sorry, don´t have an English Access)

Then you may start it via task scheduler "C:\Program Files\...\msaccess.exe I:\ /x Export"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top