VBA OpenReport Action

N

none

In the help documentation for the OpenReport Action, it gives the
following description for the Where Condition:
A valid SQL WHERE clause (without the word WHERE) or expression that
Access uses to select records from the report's underlying table or
query.

Can someone give me an example of a SQL where clause. I am not very
familiar with SQL, and have the the following:
(qQuery1.tTable1.[Yes-Internal]) <> Yes Or (qQuery1.tTable1.[Yes-
Internal]) Is Null

So that the full action reads:
DoCmd.OpenReport "rReport", acViewPreview, , (qQuery1.tTable1.[Yes-
Internal]) <> Yes Or (qQuery1.tTable1.[Yes-Internal]) Is Null

The error I get right now is 424 - Object Required.

Thank you!
 
D

Douglas J. Steele

The Where clause has to be a string. As well, you cannot include both the
name of a query (qQuery1) and the name of a table (tTable1).

Try:

DoCmd.OpenReport "rReport", acViewPreview, , "([Yes-Internal]) <> True Or
([Yes-Internal]) Is Null"

or, simpler

DoCmd.OpenReport "rReport", acViewPreview, , "Nz([Yes-Internal], False) <>
True"
 

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