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