|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a main report in which I also have a subreport. The problem is, is that I have a query that the report is based on. The query requires a parameter (Month & Year) that the user inputs when the report is generated. The subreport also uses this same parameter. I have the child and master fields linked to the query field but when the report is run, it asks for the parameter 6 times before showing the report. How can I set it up so that the parameter is only requested once and then passed to the subreport?
Thanks in advance! |
|
#2
|
|||
|
|||
|
Queries in sub reports
It may be simpler to create a form which prompts for the variables. Then change the queries to refer to the form. The form then has a button which prints the report
|
|
#3
|
|||
|
|||
|
But if I have the Child/Master Links in there shouldn't it be working right? I don't really want to do a form since the user has to do a few inputs already. If I did the form, how would I save the value until the user changes it in the form again?
The input fields are in the base queries, so to make any changes in them would cause major rework. If I put the field on the report and had the second query reference that field (whose value is determined by the user input in the first query), would that work. I am not even sure of how to go about either of these options, since I am very new at VBA and stuff. |
|
#4
|
|||
|
|||
|
Assuming that the Parent/Child links will imit the data in the subreport - do you really need parameters in the subreport query?
|
|
#5
|
|||
|
|||
|
Set your subreport record source to the underlying table from the parameter query, not the query itself. If the Parent/Child links are set correctly, you will only be prompted for the parameter for the main report and the subreport will only show records filtered by the main report.
lwells |
|
#6
|
|||
|
|||
|
I have done what you said however, all values in the underlying table are coming in. I only want the row that matches the parameter passed by the main report's query. I am also trying to see how I can get the subreport to total what is shown in the main report. More help, please?! I am new to adding subreports to a report and need some hand holding. I REALLY appreciate it!
|
|
#7
|
|||
|
|||
|
How is your main report linked with the subreport. Typically the subreport will display all records related to the main report. Example would be a supplier displaying all products that the supplier handles. So the main report would show the supplier information and the subreport would display all the products for that supplier. The subreport would be linked to the main report supplier id. Perhaps you can share with us how your tables and relationships are set up.
|
|
#8
|
|||
|
|||
|
My reports are linked on the Month Year field. We are running sales goals, totals, and % to goal for employees. The main report query shows the totals for the company broken down into departments.
The subreport needs to show how the company is doing overall. When the report runs, the main is fine. The subreport prints all records in the table regardless of Month Year input into the main report and I can't get the sales totals from the main report into the subreport. The subreport has the company's goals, I just need it to: a) only print the month indicated by the user when the main report is run. b) bring the totals for the Month Year requested for the main report & put it into the subreport so I can do the math against the company goals I am pulling my hair out on this because I have been working this for over a week with very little progress. I appreciate the help! |
|
#9
|
|||
|
|||
|
Your subreport is linked to the variable in your query, thus when the report formats it needs to run the query twice to display the report and then format the subreport which is causing you to enter the variable more than one time. The easiest work around was suggested by sherrington and that is to make a small form that will hold the variables for your query. Make a small form that will hold the parameter of dates that the user will type in before running your report. Set the query parameters values to this form. A simple form for the dates with a command button to open the report should do the trick. Otherwise you will need to rethink the relationship between the main report and subreport. Without seeing your application, it looks like what information is displayed in the subreport could easily be displayed in the main report without the need of a subreport, that is if you are using the same query for both the main and subreport.
|
|
#10
|
|||
|
|||
|
How would I create a text box that will hold the input from the user? I have tried creating the form as suggested previously but when the form is closed, the information is lost. The user doesn't want to have this form up during their whole session.
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Linking subreports and reports |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|