Query expression to filter records

R

reeve13

I am trying to build an expression in a query that will filter specifi
numbers when the value is entered. I would like the value box to rea
something like "Please enter the file number" and when entered, se
example of file # in brackets (001-200-001), it will show those record
with that file number only. In addition, because I will be printing i
from a report, the filtered file numbers should also show up in th
form.

Thanks
 
J

John Spencer

Is this for a form or a report? You mention both in your posting.

You can do this with a simple parameter query.

Field: FileNumber
Criteria: [Please enter the file number (001-200-001)]

You would be better off if you used a form to get the file number. See

Check out this article for a detailed discussion.
http://www.fontstuff.com/access/acctut08.htm

A brief quote from an John Vinson (Access MVP) posting.

You'll need to create a small unbound Form (let's call it frmCriteria) with
a Combo Box control (cboCrit) on it. Use the combo box wizard to select the
table for the selections, and be
sure that the bound field of the combo is the value you want to use as a
criterion. Save this form.

Now use

=[Forms]![frmCriteria]![cboCrit]

as the criterion in your Query.

It's convenient to base a second Form or Report on the resulting query to
display the results; if you put a button on frmCriteria to launch that form
or report, the user can enter the criterion and view the results in one
simple operation!

Quoting John Vinson

Depending on which method you use, you can reference the form control value
or the parameter in your report. Post back for further details or post in
the reports (or forms) news groups.
 
Top