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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter Problems

Status
Not open for further replies.

CopperWire

Technical User
Jun 25, 2003
47
US
Does anyone know how to set a filter based on a variable picked on a form? I can find how to get the value of a filter that has been selected, however, I want to do the opposite. I want to set the value of the filter based on criteria my user selects. Any ideas?

If I can't do that, then does anyone know how to extract data from a list of data based on user selected criteria?

For instance, When a user selects a specific town, I only want the stations to show up that are in that town, not all the stations that are in every town.

Station City Station Name
Burlington Burlington 15-42
Burlington 04-02, etc

Casey Casey 1-1
Casey 2-1


Any help would be greatly appreciated!
 
I dont know if I have got the right details of you problem.

I take it you have a table with all the staions in it, what is the structure of this table if it has the fields Station City and Station Name what you are saying can be done by using a comb box for city and a list box for station name.

If this is done the row source for the Station Name can filter out only that city selected in the Station City combo then you need a Me.Refresh on an event on the combo box.

If you give me the data structure & how you want to select the City and select the avaliable Stations I may be able to help you further.
 
CopperWire I have just realised I am not in the access forum. Is this problem for Access if not ignore the previous posting.
 
CopperWire - please do not doublepost - I have just wasted time asking for an explanation to what you want in your other post on the same subject

to set the filter, just use

myVar = TextboxName.text

With sheets("Sheetname").range("A1:Z1000")
.autofilter field:=1, criteria1:=myVar
end with

change A1:Z1000 to reflect your data and the field number to reflect the field you are filtering on

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top