Query Filtering

S

Steve

I have a Make Table Query that looks to my data table. In that data table, I
have a field named County. I would like to set a filter in the query where I
can select one of the 5 Counties that exist before the query makes the table.
I am using Access 2003.

Does anybody have any ideas?
 
S

Sharkbyte

Steve:

Set up a form to run your query. Add a combo box displaying the County
choices, then reference the combo box in the criteria of your query.

HTH

Sharkbyte
 
O

Ofer

Try this,

SELECT MyTableName.* INTO TableName2
FROM MyTableName
WHERE [County]=[Enter County Name:]

But if you want to have a list of the Counties to select from, then create a
form with a drop down box that disply all the counties, after the user select
a county, he will then click on the button and run the query

Docmd.openQuery "QueryName"
Or
Docmd.runSql "SELECT MyTableName.* INTO TableName2 FROM MyTableName WHERE
[County]Like '" & nz(Me.CountyListName,"*") & "'"

If No county selected then it will create the table with all the records.
=============================================
If you want to run a query then

SELECT MyTableName.* INTO TableName2
FROM MyTableName
WHERE [County] Like Nz(Forms![FormName]![ListBoxName],"*")
 
S

Steve

Thx

Sharkbyte said:
Steve:

Set up a form to run your query. Add a combo box displaying the County
choices, then reference the combo box in the criteria of your query.

HTH

Sharkbyte
 
S

Steve

Thx that worked.

Ofer said:
Try this,

SELECT MyTableName.* INTO TableName2
FROM MyTableName
WHERE [County]=[Enter County Name:]

But if you want to have a list of the Counties to select from, then create a
form with a drop down box that disply all the counties, after the user select
a county, he will then click on the button and run the query

Docmd.openQuery "QueryName"
Or
Docmd.runSql "SELECT MyTableName.* INTO TableName2 FROM MyTableName WHERE
[County]Like '" & nz(Me.CountyListName,"*") & "'"

If No county selected then it will create the table with all the records.
=============================================
If you want to run a query then

SELECT MyTableName.* INTO TableName2
FROM MyTableName
WHERE [County] Like Nz(Forms![FormName]![ListBoxName],"*")


Steve said:
I have a Make Table Query that looks to my data table. In that data table, I
have a field named County. I would like to set a filter in the query where I
can select one of the 5 Counties that exist before the query makes the table.
I am using Access 2003.

Does anybody have any ideas?
 
Top