DoCmd.OpenReport problem

G

Gail

Hi All,

I'm having a problem with DoCmd.OpenReport.

I have a report rptIncidents based on a query
(qryIncidentRpt) which joins two tables -tblIncident and
tblInjury (note all Incidents have a related Injury). The
report works fine by itself.

I want to set up a form to make choices via combo boxes as
to what data is reported ie only incidents on a particular
campus, or for a particular Faculty, or between certain
dates or all of the above.

If I use

DoCmd.OpenReport stDocName, acViewPreview I get
all the data (as expected)
DoCmd.OpenReport stDocName, acViewPreview, , Campus =
cboCampus NO data, no error
DoCmd.OpenReport stDocName, acViewPreview, , Campus = Me!
cboCampus NO data, no error
DoCmd.OpenReport stDocName, acViewPreview, qryIncidentRpt,
Campus = Me!cboCampus NO data, no error
DoCmd.OpenReport stDocName, acViewPreview, qryIncidentRpt,
Campus = cboCampus NO data, no error
DoCmd.OpenReport stDocName, acViewPreview, qryIncidentRpt,
Campus = Me!cboCampus NO data, no error

Syntax
DoCmd.OpenReport reportname[, view][, filtername][,
wherecondition]

Also tried with Faculty instead of Campus but same deal

I could launch into writing my own Case statements and
altering the SQL statement accordingly however, this
appeared a much easier shorter option. If only someone
can help with what I'm doing wrong.

Cheers
Gail
 

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

Similar Threads

DoCmd.OpenReport 5
DoCmd.OpenReport 1
DoCmd.OpenReport error 2501 3
DoCmd.OpenModule question 3
Access Choosing Printer VBA Access 0
Report Missing Data 2
Formatting text on a Report 3
ForeColor Question For Report 1

Top