Full Version: Another quick (possibly stupid) report question....
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
JrMayor
Another one.
I am trying to put a spreadsheet like table inside my report. I have created a subreport that does this wonderfully. However, instead of creating one table when I preview the subreport, it creates 2 1/2 pages worth. How do I modify this?
khaos
If you have records on the main report you may need link child/link master to tie the main and sub reports together. This would just be fields that match between the two, like a primary key on the main that is the foreign key on the sub or anything else like that.

HTH
Ken
JrMayor
Sorry if I am unclear. This isn't a report issue, but instead a subreport issue. I can't get the subreport to show just one table, it makes a ton of them.
JrMayor
It appears as if the chart is made 14 times. Interestingly, I have 14 values in it. What am I doing wrong here?
JrMayor
It has something to do with the record source.
khaos
This is somewhat like not joining two fields in a query. You get more records than expected. The properties mentioned are properties of the subreport control on the main report. I can't guarantee this is the solution but I'm pretty sure. Sorry to not give you enough info before but it's hard to guess the level of Access knowledge from a post.

Ken
JrMayor
Ok, how exactly do I go about doing that?
khaos
Make sure you're on the subreport control and not in the subreport, on the data tab of properties you'll see these two different properties. How it would normally be used is lets say you have a list of customers and items they bought. The main report would be customers, the sub the items. To make sure only customer 1's items show up for customer 1 put customerID (assuming this is the key field) in both of the properties. Often my link master are the controls on the main report that are bound to the fields. So I would put a hidden field (if its not shown) on the main report and call it txtCustomerID. txtCustomerID would be the only word in link master, customerID in link child. You can have more than 1 field, just use semicolons to separate.

HTH
Ken
JrMayor
My problem is that the subreport on its own creates the 14 tables. If I leave the record source blank, it makes only one table (which is what I want), but the calculations have errors, obviously. Any suggestions?
khaos
If you run the source of the subreport alone (in a normal query) does it return the number of records you expect? What if you open the subreport when it's not part of the main report?
JrMayor
What I stated in my last post happened when I opened the subreport on its own.
khaos
Then the query of the subreport must have the outer join or not be aggregated if it needs to be.
JrMayor
Could you please put that in "my low skills in access" format? I don't understand how to fix it. Thanks again.
khaos
Lets go back to the customer sample from above. If you failed to join customerID from tblCustomers to tblCustomerItems you would have an issue. The number of records returned would be multiplied out and get very large. Lets say you have 2 customers with 10 items each. You'd expect 20 records but probably get 40 or more in the return query without the join. A join is the line drawn between fields in a query. You can post the SQL (from SQL view) if you need help with this.

Ken
JrMayor
My query looks like I want it to. Basically I am creating a report from a survey that we did. The first question has a possibility of 14 answers and I am just putting a chart in the report that counts each answer. So the query lists the name of the group, and their answer. Now, when I create a subreport using this data, it makes 14 correct charts but I only want one. Does this help?
khaos
Are you using a pivotchart?
JrMayor
No, I am using the CountIff method to count the number of times each occurs and am putting the results in a text box. I am making a text box for each.
khaos
Thats the issue then. You have 14 records so are doing this count 14 times. I'd build a query like such:

SELECT 1stCountif, 2ndCountif etc and use that as the subreports source, bind each field that has a countif to the proper query field.

HTH
Ken
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.