Skipping page conditionally

M

Marianne

I have created a report, with one record plus a lot of calculated data
per page. Some of the raw data for the calculations exists in related
tables. If that raw data isn't present, I want to skip the page
completely.

I tried a record source SQL statement with an INNER JOIN to test the
existence of the related data, but that didn't work. Access doesn't
seem to like records from a joined table as a record source. I tried
setting Cancel to True in a PageHeaderSection_Print event procedure.
That canceled the whole report, not just the page. I thought about
using a filter, but it would reference the wrong table.

(By the way, where can one find the definition of the parameters to
the PageHeaderSection event procedures? I can find very little
information on this.)

Marianne
 
C

Clifford Bass

Hi Marianne,

You were heading in the right direction, if I understand it correctly.
Weed out those records without any raw data in the report's record source
query. You can do it something like this:

select MainKeyField, Field1, Field2, ..., Fieldn
from MainTable
where exists
(select *
from RawDataTable
where RawDataTable.MainKeyField = MainTable.MainKeyField);

You will of course have to adapt that to your actual table and field
names.

Clifford Bass
 
C

Clifford Bass

Hi Marianne,

You are welcome! Glad to have been able to expand your horizons.

Clifford Bass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top