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 of the VB project prints out an Access 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 the report 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? - have also tried
acViewPreview but no difference) and then stops with error 56
'application-defined or object-defined error' on the OutputTo line. How
do I fix this and get the report into Word, Excel or any other editable
format? I nievely thought this would be simple as Im a bit new to
programming - but after 2 weeks of looking without success thought I
would ask a group again for help.
Thanks in advance
Chris
Access database for various things (and the original programmer is no
longer available). project originally created in OfficeXP but now using
2003.
One section of the VB project prints out an Access 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 the report 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? - have also tried
acViewPreview but no difference) and then stops with error 56
'application-defined or object-defined error' on the OutputTo line. How
do I fix this and get the report into Word, Excel or any other editable
format? I nievely thought this would be simple as Im a bit new to
programming - but after 2 weeks of looking without success thought I
would ask a group again for help.
Thanks in advance
Chris