Show Selected Item in Combo Box

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

Guest

I have a simple (I hope) question for the group. I have an update personnel
form with a number of combo boxes and txt boxes.

My first combo box has names, onchange event is fired to fill the various
txtboxes of data from the database of the selected individual. My question
is: How do I show the selected item in the combo box with the a)List of
available items and b)the current value in the database. In ASP, I would
build a function to build the drop down list and use <option selected> to
determine that item is the current value in the database.
I have been trying to figure out the code for this all night and have not
found anything. I tried using the following code with no luck:

StateID = rst("StateID")

With combobox
Filter = "StateID=" & StateID
FilterOn = True
End With

Any guidance or help is appreciated!

Aloha,
 
You need to have 2 columns in yout combo box. The first colum would be the
list of items and the second the current data. I am assuming both of these
are in the same table, and you are using a query as the row source for your
combo box. If they are in different tables, your query will have to be able
to join them in the query. If you are not familiar with multiple column
queries, the combo box wizard does a pretty good job. after the wizard
builds the combo box, you will need to go in to it's properties and change
the column widths so that both will show.
 
Back
Top