Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help,-SubReport /Parameter Problem!!

Status
Not open for further replies.

calihiker

Technical User
Jun 13, 2003
96
US
I need to make a subreport in order to create different grouping style on the same table, but using only a subset of that data from the same table as the main report is using. My problem is that I need to use parameters on both the report and the sub-report, but by having the same parameters in both reports -I am asked twice for the same parameters. Is there a way to use just the parameters of either the main report or it's sub-report to filter the date for both reports?
Thanks in advance.
 
You should consider changing your parameter queries to use a form control as the criteria. For instance under a date field, your criteria might be:
Between Forms!frmA!txtStart And Forms!frmA!txtEnd

This solution allows you to set default values, use combo or list boxes, check integrity, see all values at once,...

Duane
MS Access MVP
 
Thanks, that worked. But, when I use a form to hold my parameter values for a query that is going to be the source query for my report, I cannot see the values in the query itself...I might need to export to excel for reporting or manipulation as well... Is there a way to make visible in the query results the fields that are dependent on the form control values?

Thanks
 
Also, if i just run the query -is there a way to have the form pop up before the query is run so the user, me, doesn't have to open the form up every time when I just want to view the results of the query???

 
You can always "see" the values in your report by entering a control source of:
=Forms!frmA!txtMyText
The form must either be open or you can enter values at the prompts. You can't get a query to open the form.

Duane
MS Access MVP
 
Ok. I have it so the form is opened when the report is run, but my problem is how to keep the report from running until after the user is done entering the values for the parameters? I tried the stop statement, but that goes into the code, and I would like to have the form active while code is suspended? Is that possible?

Thanks.
 
Nevermind ,I figured it out..

I used...

Private Sub Report_Open(Cancel As Integer)

DoCmd.OpenForm "frmParameters", acNormal, , , acFormEdit, acDialog

End Sub


Thanks for the help!! :)
 
I noticed that when I press the cancel button on my form, which is suppose to close the form AND the report... I still get prompted for the values of the field parameters in the form??? And the report still runs. Can anyone tell me what is wrong? Why doesn't my docmd.close acreport... statement not work?

Private Sub cmdCancel_Click()

DoCmd.Close acForm, "frmParameters", acSaveNo
DoCmd.Close acReport, "Report_2002GiftsAllDrops_CircPlan"

End Sub
 
I would close the report first. Normally you would want to make the form invisible if the report is still open.

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top