MS Access 2013 Report

I have a report which is basically a pic-sheet for Customer Orders. In the detail section you have a QtyOrdered, QtyShipped, and a line to X the product off, followed by a Description.

If the description contains a certain value... let's say "Bananas" for instance, I am trying to get JUST that line to be hidden/invisible.

I have this in the ON LOAD event - but it does nothing

Private Sub Report_Load()
If Me.Description.Value = "Bananas" Then
Me.QtyOrdered.Visible = False And Me.QtyOrdered.Visible = False And Me.Description.Visible = False
End If

End Sub

Appreciate any help or suggestions
dawber39Database Analyst / Application DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The on load event runs only once when the report/form is first loaded and is used to populate the RecordSource.  Your best solution based on what you requested is to use a query as the RecordSource and in the query use selection criteria that ignores the items you do not want to print.

If you want to do it in the report itself, you'll need code.   I've never tried to do this, I always use criteria in the query to control what records are selected but you should be able to use the Print event to control this.  So in the Print event, add whatever code you need to identify that this is a record you do not want to print and when you do, cancel the Print event -

If some condition Then
    Cancel = True
    Exit Sub
End If
You could include this in the recordsource of your report

... WHERE Instr(1, [Description], [Enter record exclusion text]) = 0

If your report is a name of a table or query, change it to

Select * from <table or query name> WHERE Instr(1, [Description], [Enter record exclusion text]) = 0;

This will cause a parameter input box to appear when the report runs. Enter "Bananas", and the records with "Bananas" in the description will be excluded.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You could also use Conditional Formatting to show/hide a row based on a certain value - but I would agree with Pat and Peter that you would be much better off excluding those items from the Report's data source.
dawber39Database Analyst / Application DeveloperAuthor Commented:
Thank you everyone for the help - I did wind up using the record source, and it works fine. Thank you again - you people are awesome
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.