Setting the value of a Combox

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
 
C

Chris

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.
 
K

Ken Snell

You can set the combo boc value equal to the deisred value. In VBA:

Me.cboBoxName.Value = 24

for example.
 

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