Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Filter not working on Report

Filter not working on Report

Filter not working on Report

I need to display selected entries on a form and also a report. The selection is in a variable called gstrTester. The call to the form is: DoCmd.OpenForm FormName:="frmSelected", WhereCondition:=gstrTester. The contents of gstrTester appear in the form's Property Sheet Filter box and the form appears correctly.

The same does not happen with the report. The call DoCmd.OpenReport "rptSelected", WhereCondition:=gstrTester does not fill the report filter box and so the complete table is printed, not just the selected entries.

Can someone please tell me what I'm doing wrong?


RE: Filter not working on Report

Is gstrTester just a simple string or a boolean equation? I would think you need to use something like:

CODE --> vba

DoCmd.OpenReport "rptSelected", WhereCondition:="[SomeFieldName]=""" & gstrTester & """" 

Hook'D on Access
MS Access MVP

RE: Filter not working on Report

gstrTester is a string containing a field name and a name within the field.

RE: Filter not working on Report

Sorry, I should have been a bit more specific. gstrTester contains: [field name] = "word(s) to search for"

RE: Filter not working on Report

It would have been helpfull if you had provided some exact contents of gstrTester.

To help trouble-shoot, add a text box in the Report Header section with a control source of:

CODE --> ControlSource


Hook'D on Access
MS Access MVP

RE: Filter not working on Report

An example of the contents of gstrTester is [Parish] = "Drayton]" to list all entries where the Parish is Drayton. As I stated originally this works perfectly in a form but not a report.

I'm not sure what you mean about adding a text box.

RE: Filter not working on Report

In your report design view, select the text box control from the Toolbox and add it to your report header section. Then just set its control source property as suggested.

Hook'D on Access
MS Access MVP

RE: Filter not working on Report

Thanks for your time dhookom. I have been 'fiddling' and somehow have solved the problem (I'm not sure how but I don't feel inclined to find out!). Thanks again.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close