run time error type mismatch and where to put a do command

  • Thread starter FilemakerPro_Developer
  • Start date
F

FilemakerPro_Developer

In the report property event procedure I have attached this module:

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenReport "rptMediatorEvaluation", "[ResolutionID] IN ('Resolved Some
Issues', 'No Resolution', 'Full Resolution')"
End Sub

It says run time error type mismatch.
I am trying to pass this filter to the report but I may have gotten
something wrong.

I want to attach this other module to a command button so that it opens the
report
with the above records filtered.

Private Sub cmdOpenFilteredReport_Click()

Dim stDocName As String
Dim strFilter As String
strFilter = "[ResolutionID] IN ('Resolved', Some Issues', 'No
Resolution', 'Full Resolution')"
stDocName = "rptMediatorEvaluation"
DoCm.OpenReport stDocName, acPreview, , strFilter
End Sub

I'm not exactly sure but this code should be attached to the command button
that opens the report and the do command should be on the event procedure in
the report?

thanks,
 
D

Douglas J. Steele

Note the difference between the two OpenReport statements you've got. The
first (incorrect) one only has 1 comma between the report name and the Where
condition. The second (correct) one has the view type coming after the
reportname (acPreview: other options are acViewDesign and acViewNormal, with
acViewNormal being the default), then another comma before the Where
condition.

Either call the 2nd routine from the first:

Private Sub Report_Open(Cancel As Integer)
Call cmdOpenFilteredReport_Click()
End Sub

or correct it to

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenReport "rptMediatorEvaluation", acPreview, _
,"[ResolutionID] IN ('Resolved Some Issues', 'No Resolution', 'Full
Resolution')"
End Sub

My advice would be the first alternative.
 

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