User interface on parameter queries

J

jjbf22

I was wondering how i can prompt the user of my database to select which
criteria to search by, and then have it run different parameter queries. I
have been succesful setting up different parameter queries with multiple
search criteria, but i need it to search using different criteria each time.
Any suggestions?
 
R

Rick B

You need to prompt the user.

Instead of putting a hard-coded criteria like = "Smith" you would ask the
user....

=[EnterNameToSearch]


If you want to allow partial entries, use something like...


Like "*" & [Enter Partial Search String] & "*"
 
J

jjbf22

Rick- Thanks for your quick response. The thing is- I know how to prompt the
user, its a matter of first prompting the user to select which criteria to
search by. For instance, if i have a few fields like: Industry, sector,
volume... I want the user to choose which field they would like to narrow it
down by. Eg- the user could select sector and volume, and will then be
prompted with "Enter Sector" and "Enter Mimimum Volume". I know how to do
these individually, but how can i get it so the user can choose which ones to
sort by?

Thanks again for responding. Any help would be appreciated.

Rick B said:
You need to prompt the user.

Instead of putting a hard-coded criteria like = "Smith" you would ask the
user....

=[EnterNameToSearch]


If you want to allow partial entries, use something like...


Like "*" & [Enter Partial Search String] & "*"



--
Rick B



jjbf22 said:
I was wondering how i can prompt the user of my database to select which
criteria to search by, and then have it run different parameter queries. I
have been succesful setting up different parameter queries with multiple
search criteria, but i need it to search using different criteria each time.
Any suggestions?
 
D

Douglas J Steele

I don't believe it can be done strictly through a prompt. You'd have to have
a form that lets them select which field to sort by, and alter the SQL
associated with the query before you run it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


jjbf22 said:
Rick- Thanks for your quick response. The thing is- I know how to prompt the
user, its a matter of first prompting the user to select which criteria to
search by. For instance, if i have a few fields like: Industry, sector,
volume... I want the user to choose which field they would like to narrow it
down by. Eg- the user could select sector and volume, and will then be
prompted with "Enter Sector" and "Enter Mimimum Volume". I know how to do
these individually, but how can i get it so the user can choose which ones to
sort by?

Thanks again for responding. Any help would be appreciated.

Rick B said:
You need to prompt the user.

Instead of putting a hard-coded criteria like = "Smith" you would ask the
user....

=[EnterNameToSearch]


If you want to allow partial entries, use something like...


Like "*" & [Enter Partial Search String] & "*"



--
Rick B



jjbf22 said:
I was wondering how i can prompt the user of my database to select which
criteria to search by, and then have it run different parameter queries. I
have been succesful setting up different parameter queries with multiple
search criteria, but i need it to search using different criteria each time.
Any suggestions?
 
R

Rick B

Ah. Don't know how to do that except to prompt them for all four items and
tell them to leave a prompt blank for "all".

Like "*" & [Enter Industry blank for all] & "*"



You could build an unbound form and have the available fields on the form
and let the user make entries in the ones they wat to use. You could then
pull the values to the query using the form.

like "*" & Forms![MySearchFormName]![MySearchFieldName1] & "*"
like "*" & Forms![MySearchFormName]![MySearchFieldName2] & "*"
like "*" & Forms![MySearchFormName]![MySearchFieldName3] & "*"
like "*" & Forms![MySearchFormName]![MySearchFieldName4] & "*"
etc.


You could also build a form and use the 'filter by form' feature of access.

--
Rick B



jjbf22 said:
Rick- Thanks for your quick response. The thing is- I know how to prompt the
user, its a matter of first prompting the user to select which criteria to
search by. For instance, if i have a few fields like: Industry, sector,
volume... I want the user to choose which field they would like to narrow it
down by. Eg- the user could select sector and volume, and will then be
prompted with "Enter Sector" and "Enter Mimimum Volume". I know how to do
these individually, but how can i get it so the user can choose which ones to
sort by?

Thanks again for responding. Any help would be appreciated.

Rick B said:
You need to prompt the user.

Instead of putting a hard-coded criteria like = "Smith" you would ask the
user....

=[EnterNameToSearch]


If you want to allow partial entries, use something like...


Like "*" & [Enter Partial Search String] & "*"



--
Rick B



jjbf22 said:
I was wondering how i can prompt the user of my database to select which
criteria to search by, and then have it run different parameter queries. I
have been succesful setting up different parameter queries with multiple
search criteria, but i need it to search using different criteria each time.
Any suggestions?
 
K

KARL DEWEY

Your form can have checkboxes and include them in your query along with the
"Enter ..." Use a separate criteria row for each.

Alternatively if data in your fields is radically different you might be
able to use the same criteria, "Enter ..." for each field. Use a separate
criteria row for each.

jjbf22 said:
Rick- Thanks for your quick response. The thing is- I know how to prompt the
user, its a matter of first prompting the user to select which criteria to
search by. For instance, if i have a few fields like: Industry, sector,
volume... I want the user to choose which field they would like to narrow it
down by. Eg- the user could select sector and volume, and will then be
prompted with "Enter Sector" and "Enter Mimimum Volume". I know how to do
these individually, but how can i get it so the user can choose which ones to
sort by?

Thanks again for responding. Any help would be appreciated.

Rick B said:
You need to prompt the user.

Instead of putting a hard-coded criteria like = "Smith" you would ask the
user....

=[EnterNameToSearch]


If you want to allow partial entries, use something like...


Like "*" & [Enter Partial Search String] & "*"



--
Rick B



jjbf22 said:
I was wondering how i can prompt the user of my database to select which
criteria to search by, and then have it run different parameter queries. I
have been succesful setting up different parameter queries with multiple
search criteria, but i need it to search using different criteria each time.
Any suggestions?
 
Top