WhereCondition ignored when MS Access Form invokes Report

Y

yisraelharris

I have a form with fields, and a button, whose onclick opens a report
using:

DoCmd.OpenReport myReportName, acViewPreview, , myWhereCondition

All is well: the report opens, and the parameters from the form appea
correctly in the report header.

However, the myWhereClause achieves nothing, and fails to cause th
appropriate records to be filtered out of the report. Any ideas as t
why?

The whereCondition is simply "fieldName = 222222". Please note that
ran a query with the exact same whereCondition (SELECT * FROM tableNam
where fieldName = 222222"), and there, it does work
 
R

Rick Brandt

yisraelharris said:
I have a form with fields, and a button, whose onclick opens a report,
using:

DoCmd.OpenReport myReportName, acViewPreview, , myWhereCondition

You have one comma missing in the above.

DoCmd.OpenReport myReportName, acViewPreview, , , myWhereCondition
 

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