Connecting Tech Pros Worldwide Forums | Help | Site Map

Printing multiple forms in Access 2007

Newbie
 
Join Date: Feb 2008
Posts: 2
#1: Feb 28 '08
Greetings:

I have a small Acces 2007 database that has 3 forms I need to print containing data from a recordset based on a query.

I can pull up all three forms from one button to preview the forms:

Private Sub cmdPreviewSelectChem_Click()
On Error GoTo Err_cmdPreviewSelectChem_Click

Dim stDocName As String
Dim stDocNameB As String
Dim stLinkCriteria As String

stDocName = "prntAirMonActLevels"
stDocNameB = "prntChemExpoInfo"
stDocNameC = "prntChemProperties"
DoCmd.OpenForm stDocName, acPreview
DoCmd.OpenForm stDocNameB, acPreview
DoCmd.OpenForm stDocNameC, acPreview

Exit_cmdPreviewSelectChem_Click:
Exit Sub

Err_cmdPreviewSelectChem_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewSelectChem_Click

End Sub

However, I would like to be able to call a print dialog box to print the forms to pdf. Currently I am using the windows print dialog box because I need to output to pdf (unless there is a way to print directly to pdf in Access). Calling the dialog box only prints one at a time and I need to make sure all three forms print.

Here is the code from the current print button (with a name of one of the print forms in it):

Private Sub Command5_Click()
On Error GoTo Err_Command5_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "prntAirMonActLevels"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.RunCommand acCmdPrint
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_Command5_Click:
Exit Sub

Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click

End Sub


Thanks in Advance,

Catherine

jeffstl's Avatar
Expert
 
Join Date: Feb 2008
Posts: 414
#2: Feb 28 '08

re: Printing multiple forms in Access 2007


I am honestly not sure if there is a way to print all 3 forms with one dialog command. The xperts of this forum might know.

However, I would personally recommend that rather then print your forms out you simply create a report in access that contains the data you want from all 3 forms into one convenient report. This will also make printing data from all 3 forms much easier to accomplish obviously.

Just a thought though, I am not sure what exactly your end goal is.
Newbie
 
Join Date: Feb 2008
Posts: 2
#3: Feb 28 '08

re: Printing multiple forms in Access 2007


The forms create separate pages which are different attachments to a document, so the issue of data rolling to multiple pages when printing can create a problem. I may just have to put three print buttons on the form. I have figured out how to print to pdf directly...

If I can print to the pdfwriter, the need for the dialog box goes away...except for the file "save as" dialog.

Thanks!

Catherine
jeffstl's Avatar
Expert
 
Join Date: Feb 2008
Posts: 414
#4: Feb 28 '08

re: Printing multiple forms in Access 2007


OK. I did not realize you were preparing attachement files for an email with this.

Makes sense. Sorry I couldnt help more!
Reply


Similar Microsoft Access / VBA bytes