Setting the value of a Combox

  • Thread starter Thread starter Jeff Gyarmathy
  • Start date Start date
J

Jeff Gyarmathy

Hi.

I am working on a form that has a two column combo box,
one for a team name and one for team id. The column with
the team id is hidden, once the team choice is made then
the team id is saved in a text box. Eventually the team
id and another information is saved to a database. The
combobox is unbound by the way. That works great.

The problem is that when I have a user that wishes to edit
a record. My code puts the information from the database
including the teamid. I am not able to set the combobox
using the teamid to display the corresponding team name.

Could someone show me some code that can set the value in
the comboxbox, tell me a method that I may use, or point
me to a web site that may help.

Thanks in advance,
Jeff
 
Assuming that the combo box is already loaded with the
data, all you need to do is set the combo's default value
to the id you want.
 
You can set the combo boc value equal to the deisred value. In VBA:

Me.cboBoxName.Value = 24

for example.
 
Back
Top