autofill combo if only one option

A

Adam

I have what seems to be an easy question.

I have a form with multiple combo boxes. For a few selections, the remaining
always have one choice left but you still have to click the drop down on the
combo box to select it.

How can i get the form to auto-complete the combo boxes that have only one
option left?

thanks in advance.
Adam
 
D

Douglas J. Steele

In code, you'd have to recognize that there's only a single row and then
select that row.

If Me.Combo1.ListCount = 1 Then
Me.Combo0 = Me.Combo0.ItemData(0)
End If
 
M

Marshall Barton

Adam said:
I have what seems to be an easy question.

I have a form with multiple combo boxes. For a few selections, the remaining
always have one choice left but you still have to click the drop down on the
combo box to select it.

How can i get the form to auto-complete the combo boxes that have only one
option left?


The code could be like:

If Me.somecombo.ListCount = 1 Then
Me.somecombo = Me.somecombo.ItemDate(0)
End If

Where you put that depends on the details of what you are
doing with your combo boxes and data entry scenarios.
 
A

Arvin Meyer [MVP]

If there's only 1 item, you only have to set the focus to that combo to get
its value.

Me.cboWhatever.SetFocus
Debug.Print cboWhatever
 
A

Adam

I am somewhat new to Access, but yes i think they are cascading.

I have 13 combo's, and going in order (1-13) you choose something and it
filters the next combo to fit what was chosen in the previous.

I tried the:
If Me.Combo1.ListCount = 1 Then
Me.Combo0 = Me.Combo0.ItemData(0)
End If

but had no luck. any other ideas?
 

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