Display Search results in a List box

B

bejewell

Please forgive me if this is an obvious question...

My database houses a list of files and their locations on our company's
network. My master query includes the file name, the file's current
location, and its old location, among other things.

I have created a form that allows the user to search the master list for
locations (really network folders) containing his/her specified criteria.
Several of these folders have similar names ("Environmental Justice",
"Environmental Tracking", "Environmental Management", etc.), so if the user
enters the word "Environmental" as his/her criteria, the search results
include items in all of these folders.

I would like the results of the search to display so that all of the folders
meeting the criteria appear in a list box, allowing the user to select the
specific folder he/she is looking for and pull up a list of only the files
inside that folder.

Is this possible? It must be! I just haven't had any luck figuring out how
to make it happen. Perhaps the answer is staring me right in the face but
I'm missing it?

Any help would be greatly appreciated...Thanks so much!!
 
K

Klatuu

This can certainly be done; however, since you already have the search
working, it would be important to know what method you are using to
accomplish the search and where the results of the search is.

Also, do you want the user to be able to select one folder or multiple
folders from the list?
 
B

bejewell

The user should only be able to select one folder from the list.

In my query, in the "criteria" row of the "Current Locations" column, I have
entered:

Like "*" & [Enter Phrase to Search] & "*"

I then created a form based on this query, which, when run, prompts the user
for a search term. The resulting form includes all of the records that meet
the criteria entered.

It works as long as the "Current Folders" field is a text box - it just
displays each record with its current folder in the field. But when I change
it to a Combo Box (sorry, I've been calling this is a list box, I actually
mean a combo box, because I want the user to be able to select a specific
folder from a dropdown list of folders that meet the criteria), it only shows
the current folder and a blank row in the dropdown.

Hope this answers your question??
 
K

Klatuu

Okay, here is how you do that.
Create a text box on your form for the user to put the value in instead of
letting the query pop up and ask for a value (ugly anyway).
Change the criteria in your query to look for the value in your text box:
Like "*" & Forms!MyFormName!MyTextBoxName & "*"

Make the query the row source of the combo box

In the After Update event of the text box,

Me.MyComboBox.Requery

Now, when the user puts a value in the text box and navigates away from it,
the combo will requery with what the user is looking for.

Now, if you want to get really fancy with it, you can use what is called
Cascading Combos. That is, rather than using a text box to enter the
criteria, Use a combo with a row source that will allow the user to select
something to look for. Everything else remains the same, you still use the
query the same way, you still do the requery in the after update, etc.

bejewell said:
The user should only be able to select one folder from the list.

In my query, in the "criteria" row of the "Current Locations" column, I have
entered:

Like "*" & [Enter Phrase to Search] & "*"

I then created a form based on this query, which, when run, prompts the user
for a search term. The resulting form includes all of the records that meet
the criteria entered.

It works as long as the "Current Folders" field is a text box - it just
displays each record with its current folder in the field. But when I change
it to a Combo Box (sorry, I've been calling this is a list box, I actually
mean a combo box, because I want the user to be able to select a specific
folder from a dropdown list of folders that meet the criteria), it only shows
the current folder and a blank row in the dropdown.

Hope this answers your question??



Klatuu said:
This can certainly be done; however, since you already have the search
working, it would be important to know what method you are using to
accomplish the search and where the results of the search is.

Also, do you want the user to be able to select one folder or multiple
folders from the list?
 
B

bejewell

Thanks so much for your help! I really appreciate it!

Klatuu said:
Okay, here is how you do that.
Create a text box on your form for the user to put the value in instead of
letting the query pop up and ask for a value (ugly anyway).
Change the criteria in your query to look for the value in your text box:
Like "*" & Forms!MyFormName!MyTextBoxName & "*"

Make the query the row source of the combo box

In the After Update event of the text box,

Me.MyComboBox.Requery

Now, when the user puts a value in the text box and navigates away from it,
the combo will requery with what the user is looking for.

Now, if you want to get really fancy with it, you can use what is called
Cascading Combos. That is, rather than using a text box to enter the
criteria, Use a combo with a row source that will allow the user to select
something to look for. Everything else remains the same, you still use the
query the same way, you still do the requery in the after update, etc.

bejewell said:
The user should only be able to select one folder from the list.

In my query, in the "criteria" row of the "Current Locations" column, I have
entered:

Like "*" & [Enter Phrase to Search] & "*"

I then created a form based on this query, which, when run, prompts the user
for a search term. The resulting form includes all of the records that meet
the criteria entered.

It works as long as the "Current Folders" field is a text box - it just
displays each record with its current folder in the field. But when I change
it to a Combo Box (sorry, I've been calling this is a list box, I actually
mean a combo box, because I want the user to be able to select a specific
folder from a dropdown list of folders that meet the criteria), it only shows
the current folder and a blank row in the dropdown.

Hope this answers your question??



Klatuu said:
This can certainly be done; however, since you already have the search
working, it would be important to know what method you are using to
accomplish the search and where the results of the search is.

Also, do you want the user to be able to select one folder or multiple
folders from the list?

:

Please forgive me if this is an obvious question...

My database houses a list of files and their locations on our company's
network. My master query includes the file name, the file's current
location, and its old location, among other things.

I have created a form that allows the user to search the master list for
locations (really network folders) containing his/her specified criteria.
Several of these folders have similar names ("Environmental Justice",
"Environmental Tracking", "Environmental Management", etc.), so if the user
enters the word "Environmental" as his/her criteria, the search results
include items in all of these folders.

I would like the results of the search to display so that all of the folders
meeting the criteria appear in a list box, allowing the user to select the
specific folder he/she is looking for and pull up a list of only the files
inside that folder.

Is this possible? It must be! I just haven't had any luck figuring out how
to make it happen. Perhaps the answer is staring me right in the face but
I'm missing it?

Any help would be greatly appreciated...Thanks so much!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top