My code is attempting to preview a report, then run a msgbox that asks the user if they want to print the report. In the code, the msgbox appears immediately after the report opens in preview mode. I have tried SelectObject and GetFocus, etc. but the Report cannot be manipulated until the Yes or No has been choosen (then of course the rest of the code runs...)
Is there a way to pause, or allow the user to view the Report preview and then answer the msgbox? I figure I can do a preview with a form, but I wanted to avoid this if I could.
My code is below:
Private Sub cmd_Run_5500_Only_Click()
Dim MyMsgBox
'Need to figure out how to Preview the
5500 Report before printing
'DoCmd.OpenReport "300_rpt_GWLA_5500_
Indiv", acPreview
'[Reports]!
[300_rpt_GWLA_5500_Indiv].SetFocus
MyMsgBox = MsgBox("Do you want to print the cover letter and GWLA 5500
Report for Plan # " _
& [Forms]![300_frm_ParametersforQueries_Indiv]![ctl_PLAN_NBR] & "?",
vbYesNo, "Print 5500")
If MyMsgBox = vbYes Then
'change acPreview to acNormal to actually print.
DoCmd.OpenReport "200_rpt_LettertoPolicyHolder", acPreview
DoCmd.OpenReport "300_rpt_GWLA_5500_Indiv", acPreview
'DoCmd.Close acReport, "200_rpt_LettertoPolicyHolder"
'DoCmd.Close acReport, "300_rpt_GWLA_5500_Indiv"
MsgBox ("The cover letter and GWLA 5500 Report for Plan # " _
& [Forms]![300_frm_ParametersforQueries_Indiv]![ctl_PLAN_NBR] _
& " has been printed."), vbInformation, "Printing Done"
Else
DoCmd.Close acReport, "300_rpt_GWLA_5500_Indiv"
End If
End Sub
Is there a way to pause, or allow the user to view the Report preview and then answer the msgbox? I figure I can do a preview with a form, but I wanted to avoid this if I could.
My code is below:
Private Sub cmd_Run_5500_Only_Click()
Dim MyMsgBox
'Need to figure out how to Preview the
5500 Report before printing
'DoCmd.OpenReport "300_rpt_GWLA_5500_
Indiv", acPreview
'[Reports]!
[300_rpt_GWLA_5500_Indiv].SetFocus
MyMsgBox = MsgBox("Do you want to print the cover letter and GWLA 5500
Report for Plan # " _
& [Forms]![300_frm_ParametersforQueries_Indiv]![ctl_PLAN_NBR] & "?",
vbYesNo, "Print 5500")
If MyMsgBox = vbYes Then
'change acPreview to acNormal to actually print.
DoCmd.OpenReport "200_rpt_LettertoPolicyHolder", acPreview
DoCmd.OpenReport "300_rpt_GWLA_5500_Indiv", acPreview
'DoCmd.Close acReport, "200_rpt_LettertoPolicyHolder"
'DoCmd.Close acReport, "300_rpt_GWLA_5500_Indiv"
MsgBox ("The cover letter and GWLA 5500 Report for Plan # " _
& [Forms]![300_frm_ParametersforQueries_Indiv]![ctl_PLAN_NBR] _
& " has been printed."), vbInformation, "Printing Done"
Else
DoCmd.Close acReport, "300_rpt_GWLA_5500_Indiv"
End If
End Sub