View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
onedaywhen onedaywhen is offline
external usenet poster
 
Posts: 459
Default 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