saving report

  • Thread starter Thread starter dhoover via AccessMonster.com
  • Start date Start date
D

dhoover via AccessMonster.com

I have a report with 600 pages...each page for a different client. Is
there a way to have Access automatically save each page as a separate
report? I would want each page saved using the client name field.
 
dhoover via AccessMonster.com said:
I have a report with 600 pages...each page for
a different client. Is there a way to have Access
automatically save each page as a separate
report? I would want each page saved using
the client name field.

I don't understand what you mean by "save each page as a separate report."

You can certainly use the Page Header / Page Footer to label the page with
the client's name, and, instead of using the built-in Page and/or Pages
variables, just set "Page 1 of 1" (or nothing at all for that matter) as the
page number. Then, of course, when printed, you would have a stack of 600
"one page reports". But somehow I doubt that is what you want.

Please clarify and likely someone will have a response.

Larry Linson
Microsoft Access MVP
 
I have 600+ pages of a report, each for one client. When I export the report,
I need to save each page as clientname.rtf, so if page 1 is client A and page
two is client B and page 3 is client C, then page one needs to be named
ClientA.rtf and page 2 as ClientB.rtf and so on.
 
dhoover via AccessMonster.com said:
I have 600+ pages of a report, each for one client. When
I export the report, I need to save each page as clientname.rtf,
so if page 1 is client A and page two is client B and page 3 is
client C, then page one needs to be named ClientA.rtf and
page 2 as ClientB.rtf and so on.


There is no "Save Each Page as a Separate Report" option in Access'
reporting feature. Further, I've never been very pleased with the fidelity
of .RTF report output to the format of the Report as I view it on the
screen.

You could run 600 separate reports, using the DoCmd.OpenReport with a
WhereCondition that identifies the client, but I also doubt that a 600-pass
loop is what you had in mind. Still, it may be the best and simplest
approach to obtain the output you want.

Another approach is that you write VBA code to post-process the 600-page
output file to produce 600 one-page files. As I am not familiar with .RTF
markup, I can't guess how effective that would be. From my perspective, it
would be simpler to handle if you saved the output as XML or HTML format,
because those are text files, and relatively easy to read and write, and I
think the markup is more straightforward and intuitive. This, would require
some additional coding work, but isn't "rocket science."

Larry Linson
Microsoft Access MVP
 
I've been working on the code, but haven't had much luck. I'm able to loop
through and export as htm, but it names all the reports the same even though
I have it based on the client name. This is what I have so far (though this
is using rtf format):

Dim Db As DAO.Database
Dim rst As Recordset
Dim mycondition As String
Set Db = CurrentDb

Set rst = Db.OpenRecordset("Select Customer from [Customer Info]")
While Not rst.EOF
mycondition = [Customer] = " & rst![Customer]"
DoCmd.OpenReport "Customer Instructions", , , mycondition
DoCmd.OutputTo acOutputReport, [Customer], acFormatRTF, "c:\bbtdata\" & ".
rtf", False

rst.MoveNext
Wend
 
This is the code I am using for html. I'm missing a piece but I'm not sure
what. I keeping getting the error that it can't find the field customer.


On Error GoTo Err_Label

Dim strReportName As String
Dim strFileName As String
Dim rst As Recordset
Dim strcustomer As String
Dim strFilepath As String
Dim Db As DAO.Database
Dim mycondition As String
Dim strRecordsource As String

Set rst = CurrentDb.OpenRecordset("Select Customer from [Customer Info]")

While Not rst.EOF

rst.MoveFirst


strcustomer = [Customer]
strFilepath = "C:\bbtdata\"
strFileName = [Customer] & ".html"
mycondition = strcustomer
strReportName = "customer instructions"

strRecordsource = "SELECT customer FROM [customer info]"

DoCmd.OpenReport strReportName, acNormal

Reports.Item(strReportName).RecordSource = strRecordsource

DoCmd.Close acReport, strReportName, acSaveYes

DoCmd.OutputTo acOutputReport, strReportName, acFormatHTML, strFilepath &
"" & strFileName

rst.MoveNext


Exit_Label:
On Error Resume Next
rst.Close
Set rst = Nothing
Exit Sub
Err_Label:
MsgBox Err.Description
Resume Exit_Label



I've been working on the code, but haven't had much luck. I'm able to loop
through and export as htm, but it names all the reports the same even though
I have it based on the client name. This is what I have so far (though this
is using rtf format):

Dim Db As DAO.Database
Dim rst As Recordset
Dim mycondition As String
Set Db = CurrentDb

Set rst = Db.OpenRecordset("Select Customer from [Customer Info]")
While Not rst.EOF
mycondition = [Customer] = " & rst![Customer]"
DoCmd.OpenReport "Customer Instructions", , , mycondition
DoCmd.OutputTo acOutputReport, [Customer], acFormatRTF, "c:\bbtdata\" & ".
rtf", False

rst.MoveNext
Wend
[quoted text clipped - 22 lines]
Larry Linson
Microsoft Access MVP
 
Back
Top