Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Filter

Status
Not open for further replies.

kmclane

Technical User
Apr 14, 2004
321
0
0
US
I am trying to filter a report. I have put this in the filter properties of my report:
"me.sort = '30032004001000'"
But the report still returns all records. If I take it out of quotes I get an error that the field "sort" is not valid. Any suggestions? If I can get this to work I want to code a loop to filter the report for each sortcode so I can separate them out. Thanks, Ken.

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
Hi,
I wrote an FAQ on how to send the filter criteria to the report. You can find it at faq703-2657.

HTH, [pc2]
Randy Smith, MCP
rsmith@cta.org
California Teachers Association
 
I'm just trying to enter it in the field in the report properties, and it won't work. I was wondering if anyone knew how to get it to work there. Once I "see" it work, then I will work on coding it. I was just trying to test it. I have read your FAQ prior and will use it when I implement my final solution, but it bugs me that it doesn't work, I don't know where the problem is.
Thanks, Ken.

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
Hi,
Try this format in the Filter properties:
([FieldNameTOfilter]= '30032004001000')


HTH, [pc2]
Randy Smith, MCP
rsmith@cta.org
California Teachers Association
 
Hi,
Did you also notice that you need to have "Filter On" set at "Yes"?

HTH, [pc2]
Randy Smith, MCP
rsmith@cta.org
California Teachers Association
 
Nope, same result. I get the error that Jet does not recognize "[sort]" as a valid field name or expression.
Which it is. It is a textbox set to not visible. But I have tried other controls on the report. Do I need to reference the field in the recordsouce instead of the bnox on the report?
Ken

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
That was it, I happened to shorten the name of the field when I named the textbox. Changed it to "[sortcode]" and it worked great. Now, once I get some more calculations ironed out, I can start on the code to out put these to pdf's.
Thanks, Ken

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
I did notice that, and it was. My problem I think was that I was trying to refence a value that did not exist yet. Some Mondays are not worth coming to work.
Ken

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
HELP!!
I've kind of the same problem, only I won't reach to a solution... can you help me?

I've got the following phrase in my program:

DoCmd.OpenReport stDocName, acViewPreview, "([SITE ID]= '002')"

Normally this filter should work, because [SITE ID] is a member of the table SITES, but in stead it keeps showing all the records, no error message

PS ... in my report the property FILTER ON is turned on
 
Note that my filter is set on a textbox on the report, not a table, even thought the table field does exist. Try putting a textbox on the report and changing your filter to that, have the text box use the table field as a data source. You can make the box not visible if you don't want it to show.
Ken

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
Hi airtabaki,
I think you are missing an extra parameter. Here is the proper syntax of DoCmd.OpenReport:
DoCmd.OpenReport "ReportName", acPreview, , strFilter
HTH, Randy
PS - note the blank parameter situated right after the "acPreview
 
missing a comma--

DoCmd.OpenReport stDocName, acViewPreview,, "([SITE ID]= '002')"


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top