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

Help getting away from static criteria

Status
Not open for further replies.

DaveMac

Technical User
Apr 9, 2000
161
0
0
US
I have several queries that have static criteria typed in. These are each specific to the user. The users are spread out and need to only see their data sets so I set the criteria then rename and send the DB.

My question is how could I point the various queries and various fields to a table with one record in it that is all the different filters?

Is that even the best way?

Example of what I have:

DB_Texas_Sales_Pete
Qry_1 – State field criteria “Texas”
Qry_2 – Region Field criteria “South”

DB_NY_Sales_Steve
Qry_1 – State field criteria “NY”
Qry_2 – Region Field criteria “NE”


Example of what I think I need
DB_Texas_Sales_Pete
Qry_1 – State field criteria “tbl_config.State.top_1” and it is set as “Texas”
 
If you had a table User_states you could list the state of the user storing the windows (presumably network username).

Then rather than using criteria for the state, inner join to the table and from the user_states, use the user name as criteria... There are other API call ways of getting the answer but the easy way where people aren't trying to break it is to usee...

Code:
environ("Username")

Use that as the criteria for the username.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top