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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress report page printing if condition is met

Status
Not open for further replies.

markbrum

Technical User
Mar 10, 2003
46
GB
Hi,

I have a report which I would like to have print only pages where
textboxA = "mystring"

(I can't filter these pages out with the query that runs the report because I have multiple records on a page and dropping the records at that stage would break my formatting.)

Thanks,
Mark.
 
You should be able to go into the PROPERTIES of the report, click on DATA and add your filter there. That would keep the query intact but only output the results you want. Make sure you set FILTER ON LOAD to YES as well while you're in there. Hope this helps.
 
One additional note: Using your example, the syntax in the FILTER field would be

textboxA='mystring'

(note the single quotes)

Double quotes seems to mess it up, at least in Access 2007.
 
Filtering the report like this would cause the same problem as amending the query:-

My table is like a series of invoices – Record 1 is a 'header' record, it has the customers name and address etc, this is followed by a variable number of associated records (the invoice lines). Then it hits the header record for the next customer, followed by their invoice lines. I tell my report to turn onto the next page when it hits the next header record.

I want to put a flag in the header record to say don't print this page. If I filtered by this flag field then it would dump the header record out of the query but leave in the invoice lines which would throw every thing out.
 
If you filter the query from the field that populates the header, you shouldn't break anything in the main section. Of course, I'm assuming that you're using a JOIN query to put the header and main section info together. If it's all one query, then I can see that sometimes filtering a field will break other sections.

In that case, I would break it up into two queries: One for the header and one for the invoice lines. You can then filter the header BEFORE joining the data to the invoice query and it should continue to work properly. As long as your relationships are OK, you shouldn't lose any invoice info from the filter.
 
You can cancel the printing of report sections using some code in the On Format event. I believe it would be very difficult to "Suppress report page printing" but fairly simple to "Suppress report section printing".

Do you really need to suppress pages or can you get by with suppressing specific sections?

Duane MS Access MVP
 
MMSMSD:

I am running the report from a flat table. I understand that this would be a million times better if I was dealing with a proper relational structure with a 'customer' table and a 'invoice line' table. If I had that I wouldn't be bothering you guys.

I am dealing with the output of some bespoke system, currently we have to pull the flagged records out by hand, I was trying to automate the process. I don't think that reverse engineering this table back into a relational system is possible, or at least not without a major amount of work.

dhookom:

If what you're saying is that I could end up with a blank page then that won't really solve my problem because we'll still have to manually pull them out.

 
You would add code like:
Code:
  Cancel = (Me.txtboxA<>"mystring")
This code would go in the On Format event of a section. Since the formatting is canceled, it will not create blank pages.

Duane
Hook'D on Access
MS Access MVP
 
Haven't been able to get this working yet but it looks like it might work with some fiddling. Thanks a lot for your help. I will work on it and post to let you know how I've got on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top