supressing "item not found" error

M

Mark Kubicki

I'm using the following code to display a report (where the contents of the
IN() statement are built by code not shown here...)
essentially it works; with one exception:

It is possible that an item included (in the IN()), may not have any related
records to display in the report; this returns the error "item not found".

How can I suppress the error? Alternately, I could write code that would
check for the existence of the item in the collection as the IN() statement
is being built...
Any thoughts, suggestions?

DoCmd.OpenReport stDocName, acPreview, , [Type] IN("TA", "TB", "TE",
TF"...)

thanks in advance,
Mark
 
D

Duane Hookom

This code
DoCmd.OpenReport stDocName, acPreview, , [Type] IN("TA", "TB", "TE",
TF"...)
would never work. Have you stepped through the code to see where the error
actually occurs?

The where condition basically gets applied to the Filter property of the
report and shouldn't generate an error based on the list inside the ()s
unless no records are returned in the report.
 

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