Use a Combo Box in the Criteria field of a Query.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to perform a query that allows a combo box to be used. I've went
to the MS Office website, and tried what they suggested. It didn't work. I
have created a form that has the combo box allowing a user to choose a
customer name. When I go into my query design, and type in [Forms]![Module
Entry]![Customer Name] in the criteria field, nothing happens. The dialog
box will come up, but it doesn't come up with the form I made and the combo
box is not included.
 
Matt said:
I am trying to perform a query that allows a combo box to be used. I've went
to the MS Office website, and tried what they suggested. It didn't work. I
have created a form that has the combo box allowing a user to choose a
customer name. When I go into my query design, and type in [Forms]![Module
Entry]![Customer Name] in the criteria field, nothing happens. The dialog
box will come up, but it doesn't come up with the form I made and the combo
box is not included.

You have to reverse your thinking compared to self-prompting parameters.
The form has to be open and the ComboBox selection made BEFORE you run the
query.
 
I might have explained myself wrong:
I have a database that includes customer names, decision makers, btn's, etc.
I want to perform a query that prompts a user to select a customer name from
a list. Kind of like when you have a criteria that asks for a user to type
in a customer name, only I want a list or combo used. I'm able to run a
query that has a rep type in the information, but if they don't get the name
exactly right then it won't pull up anything. I also don't want to use the
"like" function because we have many customers and if someone types in "Wal"
or "alt", they will still pull up a lot of data. A list box would be more
beneficial to use. Can you explain how to make this type of function in a
database?


Rick Brandt said:
Matt said:
I am trying to perform a query that allows a combo box to be used. I've went
to the MS Office website, and tried what they suggested. It didn't work. I
have created a form that has the combo box allowing a user to choose a
customer name. When I go into my query design, and type in [Forms]![Module
Entry]![Customer Name] in the criteria field, nothing happens. The dialog
box will come up, but it doesn't come up with the form I made and the combo
box is not included.

You have to reverse your thinking compared to self-prompting parameters.
The form has to be open and the ComboBox selection made BEFORE you run the
query.
 
Matt said:
I might have explained myself wrong:
I have a database that includes customer names, decision makers, btn's, etc.
I want to perform a query that prompts a user to select a customer name from
a list. Kind of like when you have a criteria that asks for a user to type
in a customer name, only I want a list or combo used. I'm able to run a
query that has a rep type in the information, but if they don't get the name
exactly right then it won't pull up anything. I also don't want to use the
"like" function because we have many customers and if someone types in "Wal"
or "alt", they will still pull up a lot of data. A list box would be more
beneficial to use. Can you explain how to make this type of function in a
database?

As I said, you create your form with the desired ComboBox name. You
display the form *first*, have the user make a selection, and then provide
a button that runs the form or report based on your query (you really
shouldn't show a user the query directly).

The query's criteria entry would look like...

Forms!NameOfForm!NameOfComboBox
 
Rick Brandt said:
As I said, you create your form with the desired ComboBox name. You
display the form *first*, have the user make a selection, and then provide
a button that runs the form or report based on your query (you really
shouldn't show a user the query directly).

The query's criteria entry would look like...

Forms!NameOfForm!NameOfComboBox

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

That is how my criteria looks. I have it exactly like that, but the form does not come up.
 
form does not come up.

I keep telling you that the form must *already be opened* before you open
the query. You cannot make the act of running the query to cause the form
to open as queries do not have events that you can attach code or macros
to.
 
I ended up adding the form to my switchboard which made it run the query. I
have another question now.

I've built a Switchboard for my people to use so they won't have to go find
their files in each tables, queries, etc tab. This way they only have to
click a button. My question is, how can I get it to where the files that I
click on come up in front of the switchboard instead of behind it. I'd like
it if when someone clicks on say their module list, their module table will
pull up in front of the switchboard, instead of having to minimize the
switchboard to view it. This is also they case if I have a button that goes
to another form.
 
Matt said:
I ended up adding the form to my switchboard which made it run the query. I
have another question now.

I've built a Switchboard for my people to use so they won't have to go find
their files in each tables, queries, etc tab. This way they only have to
click a button. My question is, how can I get it to where the files that I
click on come up in front of the switchboard instead of behind it. I'd like
it if when someone clicks on say their module list, their module table will
pull up in front of the switchboard, instead of having to minimize the
switchboard to view it. This is also they case if I have a button that goes
to another form.

Unless your Switchboard has its popup property set to Yes then anything new that
is opened should automatically be in front of it. If (for some reason) you want
the Switchboard to have its Popup property enabled then you have to also set the
Popup property to Yes for every other form you open (if you want them in the
front).
 
Back
Top