views:

82

answers:

1

This is a question about Reports in Access 2007. I'm unsure whether the solution will involve any programming, but hopefully someone will be able to help me.

I have a report which lists all records from a particular table (call it A), and groups them by their associated record in a related table (call it B). I use the 'group headers' to add the information from table-B into the report.

The problem occurs when I filter the records from table-A that are shown in the report. If I filter out all table-A records that relate to a particular record (call it X) in table-B, the report no longer shows the record-X group header.

As a possible workaround, I have tried to ensure that I have one empty record in table-A for each of the records in table-B. That way I can specify NOT to filter out these empty records. However, the outcome is ugly one-record-high blank spaces at the start of each group in the report.

Does anyone know of an alternative solution?

EDIT:

For clarity, I should highlight what I hope to achieve. For records in table-B that are not linked to any records in the filtered table-A, the group header (and footer) for these records will not appear in the report. I am trying to change this, so that the group header and footer appears immeiately after each other (since there are obviously no records to put in the group body).

A: 

Consider a query with a LEFT JOIN between TableB and TableA as the data source for your report. I don't understand your situation well enough, but my gut suggests the LEFT JOIN may point you to something useful. It shouldn't take much effort to find out.

Create a new query in the query designer. Add in TableB and TableA. Create a join line between the appropriate "linker" fields in the two tables, and select the join type like "all rows from TableB and matching rows from TableA" from the properties for the join line. If, when you view the results returned by the query, it gives you all the information you want for your report, make a copy of your report and use the query as the data source for that copy.

HansUp
Thanks, I've tried your suggestion but I don't think it'll get me anywhere better than my original workaround did. The method you've described successfully ensures that at least one query record is produced for each record in both tables A and B. I could try to link this with my report, but I'd still have several one-record-high spaces in my report. I'll add some more clarity to my question.
Newbie