Auto Report Print from Combo Command

  • Thread starter Thread starter Londa Sue
  • Start date Start date
L

Londa Sue

I created a combo box to allow for selection of an ID to drive the generation
of a report. The code is as follows:

Private Sub cmdOK_Click()

DoCmd.OpenQuery "qry_mainreport", acViewNormal, acEdit

DoCmd.OpenReport "41 Internal Project Audit Report", , , "IPAID= '" &
Me.cboIPAReport & "'"

DoCmd.Close acForm, "frm_SelectIPAID"

The issue I have with this is that the report automatically prints. After I
select an ID, the query runs, query table shows, and then the report prints.
What I would like it to do is have the report become viewable and then allow
the user to choose whether or not to print.

How should I adjust the code for this to happen?

Thanks as always,
 
Londa Sue,
Try...
DoCmd.OpenReport "41 Internal Project Audit Report", acViewPreview , ,
"IPAID= '" & Me.cboIPAReport & "'"

acViewPreview let's you look at the report before printing/not printing.

By the by, not sure why you're calling "qry_mainreport?"
If that's the RecordSource for your report, there's no need to manually
call it... the report will do that.

--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Wonderful!

Thank you.

Al Campagna said:
Londa Sue,
Try...
DoCmd.OpenReport "41 Internal Project Audit Report", acViewPreview , ,
"IPAID= '" & Me.cboIPAReport & "'"

acViewPreview let's you look at the report before printing/not printing.

By the by, not sure why you're calling "qry_mainreport?"
If that's the RecordSource for your report, there's no need to manually
call it... the report will do that.

--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Back
Top