Report Data Splitting

O

Outatym

I have a form with a command button. When this button is clicked it runs
code that will run a query and open up a report, call up the print command so
that I can print pdfs, then closes that report out, and then cycles to the
next report for the same actions. On 4 of the reports I need to split the
query's results into 2 separate reports. For example, right now say report
"A" has 4 pages. I am having to manually open up the printed PDF then split
it into report "A1" & "A2".

Is there any way so that Access can split the files inhalf for me while the
code is running so that this last step can be eliminated?

I have pasted my code below so that you can see what is going on:

**********************************************************

Private Sub CMDBUTTON_Click()
On Error GoTo Err_Command4_Click
DoCmd.OpenReport "AL Report", acViewNormal, "", "", acNormal
DoCmd.Close , "AL Report"
DoCmd.OpenReport "AR Report", acViewNormal, "", "", acNormal
DoCmd.Close , "AR Report"
DoCmd.OpenReport "FL Report", acViewNormal, "", "", acNormal
DoCmd.Close , "FL Report"
DoCmd.OpenReport "GA Report", acViewNormal, "", "", acNormal
DoCmd.Close , "GA Report"
DoCmd.OpenReport "IL Report", acViewNormal, "", "", acNormal
DoCmd.Close , "IL Report"
DoCmd.OpenReport "IN Report < 15", acViewNormal, "", "", acNormal
DoCmd.Close , "IN Report < 15"
DoCmd.OpenReport "IN Report > 15", acViewNormal, "", "", acNormal
DoCmd.Close , "IN Report > 15"
DoCmd.OpenReport "KY Report < 15", acViewNormal, "", "", acNormal
DoCmd.Close , "KY Report < 15"
DoCmd.OpenReport "KY Report > 15", acViewNormal, "", "", acNormal
DoCmd.Close , "KY Report > 15"
DoCmd.OpenReport "MO Report", acViewNormal, "", "", acNormal
DoCmd.Close , "MO Report"
DoCmd.OpenReport "MS Report", acViewNormal, "", "", acNormal
DoCmd.Close , "MS Report"
DoCmd.OpenReport "OH Report", acViewNormal, "", "", acNormal
DoCmd.Close , "OH Report"
DoCmd.OpenReport "SC Report", acViewNormal, "", "", acNormal
DoCmd.Close , "SC Report"
DoCmd.OpenReport "TN Report", acViewNormal, "", "", acNormal
DoCmd.Close , "TN Report"
DoCmd.OpenReport "WV Report", acViewNormal, "", "", acNormal
DoCmd.Close , "WV Report"


DoCmd.Close , "PrintReports"

Exit_Command4_Click:
Exit Sub

Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click

End Sub

**********************************************************

Any help would be greatly appreciated!

Thanks!
Chris
 
J

Jim Burke in Novi

Can you somehow split each query into two queries? e.g. if a query is going
after a years worth of data, have one that goes after the first 6 months,
another that goes after the last 6. Obviously this doesn't work if you have
no way of knowing how to logically split it up. There is a DoCmd.PrintTo
command where you can specify the pages you want printed, but I don't know if
this would work with what you're trying to do with PDFs. It may just go
straight to a printer, I've never used it.
 
O

Outatym

The data being pulled is on a monthly basis. Each month the data is
completely different. I have no idea how many records will be on the report
except after the query has run. For instance.....if the report has 250
records, I need to code to split it into 2 reports of 125.
 

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