ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DoCmd.OpenReport problem (https://www.excelbanter.com/excel-programming/292473-re-docmd-openreport-problem.html)

onedaywhen

DoCmd.OpenReport problem
 
Your question belongs in a MS Access forum.

--

"Gail" wrote in message ...
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



All times are GMT +1. The time now is 12:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com