Newbie question - How do I output Access Report to Word instead of Printer?


C

chris

Hi everyone. Im trying to update a Word VB project which accesses an
Access database for various things (and the original programmer is no
longer available). project originally created in OfficeXP but now using
2003.

One section prints out a report including a number of fields matching
certain criteria using the following code;

Set acc = CreateObject("Access.application")
acc.opencurrentdatabase dba$
For tx = 0 To (cbogfile.ListCount - 2) \ 30
acc.DoCmd.OpenReport xreport$, 0, xreport$, tstring$(tx)
Next
acc.Quit

Thats fine, but I want to be able to export it to Word or Excel or some
other editable format instead of sending it straight to the printer.
xreport$ = "TMReport" so tried the following lines to replace the
DoCmd.OpenReport line;

acc.DoCmd.OpenReport "TMReport", acPreview, "", tstring$(tx)
acc.DoCmd.OutputTo acOutputReport, "TMReport", acCmdOutputToExcel,
"f:\Test.rtf"

which prints (why - shouldnt this just preview?) and then stops with
error 56 'application-defined or object-defined error' on the OutputTo
line. How do I fix this? I thought this would be simple and Im new to
programming - but after 3 days of looking without success thought I
would ask a group for help.

Thanks in advance
Chris
 
Ad

Advertisements

Ad

Advertisements

C

chris

Tried that - didnt have any effect (it still prints)
Any ideas for getting the TMReport table into a different program?
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top