Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / December 2005

Tip: Looking for answers? Try searching our database.

Printing a series of reports

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Harry V - 12 Dec 2005 21:05 GMT
I'm using ACCESS 2003 and ADO

I'm trying to print a series of reports from a form.  The form asks for key
field values, formats and executes SQL to bring a number of records into a
recordset and moves through the recordset via a Do While Not recordset EOF
loop
to build a filter clause to pass to a report, as well as a file name to
output text files to and run the commands:  

DoCmd.OpenReport "myReport", acViewPreview, "myQuery", myFilter
DoCmd.OutputTo acOutputReport, "myReport", acFormatTXT, myFileName, False

Each report is run in turn, but  I don't have the opportunity to close each
file during the preview, in fact a single preview is displayed while messages
flash saying it is writing each file.  The files, though named properly, all
end up with the same text, rather than different report text content.  

I'm missing something - is there a way to force a pause between each report
during preview or is there a property in the report that ensures that the
report is closed before then next one is opened?  The preview isn't necessary
- the user only needs the text files.

Signature

Harry E Vermillion
IT2
Division of Wildlife
State of Colorado

David Lloyd - 14 Dec 2005 00:39 GMT
Harry:

If you just need the reports as text files, I would suggest something like
the following:

DoCmd.OpenReport "myReport", acViewPreview, "myQuery", myFilter, acHidden
DoCmd.OutputTo acOutputReport, "", acFormatTXT, myFileName, False
DoCmd.Close acReport, "myReport", acSaveNo

By not specifying the ObjectName parameter in the OutputTo method, the
active object (in this case the report) is chosen by default.  The acHidden
parameter of the OpenReport method makes the Print Preview invisible to the
user.  The Close method takes care of closing the report on each iteration
through the loop.

Signature

David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.

I'm using ACCESS 2003 and ADO

I'm trying to print a series of reports from a form.  The form asks for key
field values, formats and executes SQL to bring a number of records into a
recordset and moves through the recordset via a Do While Not recordset EOF
loop
to build a filter clause to pass to a report, as well as a file name to
output text files to and run the commands:

DoCmd.OpenReport "myReport", acViewPreview, "myQuery", myFilter
DoCmd.OutputTo acOutputReport, "myReport", acFormatTXT, myFileName, False

Each report is run in turn, but  I don't have the opportunity to close each
file during the preview, in fact a single preview is displayed while
messages
flash saying it is writing each file.  The files, though named properly, all
end up with the same text, rather than different report text content.

I'm missing something - is there a way to force a pause between each report
during preview or is there a property in the report that ensures that the
report is closed before then next one is opened?  The preview isn't
necessary
- the user only needs the text files.

Signature

Harry E Vermillion
IT2
Division of Wildlife
State of Colorado

Harry V - 14 Dec 2005 17:47 GMT
thanks David, but in trying that solution, I get an error:

Run-time error "2487"
The ObjectType argument for the action or method is blank or invalid.

But putting the report name back in worked just fine.

I was looking for the close statement, but it didn't appear to apply to a
report.

Thank you

Harry V

Signature

Harry E Vermillion
IT2
Division of Wildlife
State of Colorado

> Harry:
>
[quoted text clipped - 34 lines]
> necessary
> - the user only needs the text files.
David Lloyd - 14 Dec 2005 20:08 GMT
Harry:

I didn't get an error using an empty string as the ObjectName for the
OutputTo method.  This syntax is supported according to the Access help
topic for this method.

Nevertheless, I am glad you were able to make it work.

Signature

David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.

thanks David, but in trying that solution, I get an error:

Run-time error "2487"
The ObjectType argument for the action or method is blank or invalid.

But putting the report name back in worked just fine.

I was looking for the close statement, but it didn't appear to apply to a
report.

Thank you

Harry V

Signature

Harry E Vermillion
IT2
Division of Wildlife
State of Colorado

"David Lloyd" wrote:

> Harry:
>
[quoted text clipped - 40 lines]
> necessary
> - the user only needs the text files.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.