Form with Command button

nh1234

Registered User.
Local time
Today, 03:16
Joined
Dec 27, 2005
Messages
26
Hi,

I created a form that lets the user choose specific criteria, through a combo box, to run a report that houses several subreports. Each combo box is referencing 4 queries needed to run the report.

=[Acctmgr_renewed_detail]![RenewalMonth] And [Acctmgr_begbal_2005]![RenewalMonth] And [Acctmgr_cancelled_sum]![RenewalMonth] And [Acctmgr_renewed_sum]![RenewalMonth]

The form also includes a command button to preview the report. However, when I click the command button, the prompts for parameter values for the report popup again, when it should just print the report. Below is the code attached to my command button:

Private Sub Command2_Click()
Me.Visible = False
DoCmd.OpenReport "Acctmgr_monthly_activity", acViewPreview
DoCmd.Close acForm, "valarie"
End Sub

Is there something I need to add to my code? If so, what? Any help would be much appreciated.

Thanks
 
You will probably need to create a filter based on the results of your combo boxes and you can either pass it to your report when you DoCmd.OpenReport or set it after the report is opened and then apply the filter.

Without knowing the source for your combo boxes and what info they return, this is all the help that I can offer.
 

Users who are viewing this thread

Back
Top Bottom