Display first value of the combo box

I

Irene

hi, i have a question about the combo box. I have make two combo box in a
subform. one is choose the part. the second is the price. now i wanna when i
choose the part, if the part just have one price, then i want the price which
is in the second combo box will directly show me the price. if the part have
many type of price (due to different qty, so have different price), then the
user just go to select the price for that part. anybody can help me?

thanks!
 
J

Jeanette Cunningham

Irene,
each item in a combo's list has a number, starting with 0 for the first one.

You can count how many items in the list, if there is only one, you can tell
the combo to show it.

In the after update event of the parts combo, or the enter or got focus
event for the price combo, put some code like this:

If Me.ComboPrice.ListCount = 1 Then
Me.ComboPrice = Me.ComboPrice.ItemData(0)
End If


Jeanette Cunningham
 

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