Dropdown menu in a form

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

Guest

How do I make a form that contains a dropdown menu open and automatically go
to the first item on the dropdown list?
 
Jos1er said:
How do I make a form that contains a dropdown menu open and
automatically go to the first item on the dropdown list?

You're using confusing terminology. Do you want a drop down "Menu" or do
you want a ComboBox which is a form control that offers a drop down list of
choices?
 
I have a lookup and the form takes the values from teh lookup. I want the
form to open and the first item on the list to be shown.
 
Jos1er said:
I have a lookup and the form takes the values from the lookup. I want
the form to open and the first item on the list to be shown.

Okay, that control is called a ComboBox. In the Open event of the form...

Me.ComboBoxName = Me.ComboBoxName.Column(0,0)

The above assumes that the BoundColumn property of the ComboBox is set to 1.
 
What field within the event of the form should I be looking to in order to
make sure that the drop downs will start at teh first item.
 
Jos1er said:
What field within the event of the form should I be looking to in
order to make sure that the drop downs will start at teh first item.

Not sure I follow that question. The code I posted could be in the Open
event if you only need it to run when the form is first opened. Exactly
what do your ComboBoxes do and when do you need them to be set to the first
choice in the list? That will determine which event to use.
 
my drop down combo box runs a specific query with the name in the drop down.
I want so that wen i open the form the drop down is refreshed to the first
item in the list.
 
Jos1er said:
my drop down combo box runs a specific query with the name in the
drop down. I want so that wen i open the form the drop down is
refreshed to the first item in the list.

Okay, then putting the code I gave you in the Open event of the form should
do that.
 
Another question too. I have two combo boxes how do i make them both go to
first item? Why is it that once I pick an item and then close out of the form
it changes the table that it is linked too and puts the last item selected as
the first record in the table.
 
Jos1er said:
Another question too. I have two combo boxes how do i make them both
go to first item?

Just add a second line identical to the first one I gave you substituting
the name of the second ComboBox.
Why is it that once I pick an item and then close
out of the form it changes the table that it is linked too and puts
the last item selected as the first record in the table.

Are the ComboBoxes bound? They should not be. Check that the ControlSource
for both is blank.
 
I have to make it bound because i need the query to automatically read the
name that is in the drop down once selected. What does the "me" stand for in
the code?
 
Jos1er said:
I have to make it bound because i need the query to automatically
read the name that is in the drop down once selected.

Is the query pulling the value from the form or from a table? If you are
referencing a control on a form there is no requirement that it be bound.
What does the "me" stand for in the code?

Me is a generic reference to the container the code is running in. So in
this case it refers to the form.
 
Yup, I got it. There was no need for a control source. The name was the only
thing needed. I got rid of the source and now the form opens with a blank
item in the dropdown. Thank You.
 
I need to have the dropdowns go back to the blank field after an item is
selected on the dropdown
 
Jos1er said:
I need to have the dropdowns go back to the blank field after an item
is selected on the dropdown

If you do that then there will be no value in the control for your query to
pick up.
 
Is there any way for me to make the dropdowns go back to a blank field or to
refresh the page without having to do it in VBA. everything in the DB is
running off of Macros because when I change VBA I get a compile error.
 
Back
Top