View Full Version : Print Macro STOPS after a certain amount of records


Marbinski
10-05-2004, 04:06 PM
I believe I have a similar problem to this previous post:
http://www.access-programmers.co.uk/forums/showthread.php?t=68902&highlight=print

I currently have a form that has several subform pages. I have a PRINTALL Macro that does this:

GoToControl: Subform1
PrintOut: Selection
GoToControl: Subform2
PrintOut: Selection

etc....

I have it do that for 11 Subforms. My problem occurs when my main form has more than 20 records, it would have to print 11 forms for each records, so I'm assuming I'm running into the problem similar to the previous thread. I already converted the macro to VBA, but I am looking for the looping code to ensure that it prints all records in the main form VS. calling the macro again.

here is the VB code:

Function PrintAll()
On Error GoTo PrintAll_Err

DoCmd.Echo False, "Printing..."
DoCmd.GoToControl "General Directory Info"
DoCmd.PrintOut acSelection, , , acHigh, 1, True
DoCmd.GoToControl "Key Close Dates"
DoCmd.PrintOut acSelection, , , acHigh, 1, True
DoCmd.GoToControl "Responsible Depts"
DoCmd.PrintOut acSelection, , , acHigh, 1, True
DoCmd.GoToControl "Cover Info"
DoCmd.PrintOut acSelection, , , acHigh, 1, True
DoCmd.GoToControl "Front of Book Info"
DoCmd.PrintOut acSelection, , , acHigh, 1, True
DoCmd.GoToControl "White Pages Info"
DoCmd.PrintOut acSelection, , , acHigh, 1, True
DoCmd.GoToControl "Govt Pages Info"
DoCmd.PrintOut acSelection, , , acHigh, 1, True
DoCmd.GoToControl "Yellow Pages Info"
DoCmd.PrintOut acSelection, , , acHigh, 1, True
DoCmd.GoToControl "Misc Info"
DoCmd.PrintOut acSelection, , , acHigh, 1, True
DoCmd.GoToControl "Marketing Estimates"
DoCmd.PrintOut acSelection, , , acHigh, 1, True
DoCmd.GoToRecord , "", acPrevious
DoCmd.RunMacro "PrintAll", 1000, "" <-------THIS IS WHAT I WANT TO FIX


PrintAll_Exit:
Exit Function

PrintAll_Err:
MsgBox Error$
Resume PrintAll_Exit

End Function




Thanks for any input and help on this situation.

Marbinski
10-06-2004, 10:10 AM
I basically am looking for VB code that will Loop my code until it goes through all records. "Print all subforms for each record"

I am not very saavy with the VB syntax so any help would be very helpful. Thanks again.

Rich
10-06-2004, 11:53 AM
Forms are not designed with printing in mind, use a Report and subReports instead, however your design looks rather suspicious, why do you have 11 subForms?

Marbinski
10-06-2004, 12:06 PM
I currently have a database that keeps track of directories. Each directory has 11 sections. I set up a form for the directory that has 11 different page tabs in order to view all information on one form. I am trying to print certain pages from this form when the user presses the "print all" button. My scenario is when i have more than 20 directories to print, the macro I have already set up halts. I attatched a screenshot to give you anyone a visual on what I am trying to do.

Thanks to anyone trying to help.

Rich
10-06-2004, 02:01 PM
Again Reports are the way to go, Forms are not designed with printing in mind and the Print Out method is unpredictable

Marbinski
11-04-2004, 10:56 AM
I went ahead and create reports for these instead of using the actual form. Thanks for the help Rich.