Reports! keyword problem in VBA script


Andre C

On a form I allow the user, via an option grouip to select a report.

I code this in a string variable called strReport.

Once I set up the SQL funciton and other stuff I have the following

strFilter = "[CCN-ID] " & strCCN & _
" AND [consultantID] " & strconsultant & _
" AND [PCT-ID] " & strPCT & _
" AND [DiseaseID] " & strdisease & _
" AND [Active] " & strcaseload

' Apply the filter and switch it on

With Reports![strReport]
.Filter = strFilter
.FilterOn = True

End With

VBA doesn't like the With Reports! line. It tried to find a report
actually called strReport and not the string it contains. How do I get
around this?


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