Single Item ComboBox ?


J

Jay Wilson

I have a form that has 2 combo boxes on it. The selections for combox2
dynamicly change based on what is selected from combox1. If combox2 only
has a single selection available, I want to automatically have combox2 use
it without me type anything. How can I do this?

I thought I could do the following, but it doesn't do what I want. I made
sure "Column Heads" is set to No. I know the "If" condition has been met,
because I traced the execution, but I never see the Value appear in
combox2.

If Me.Combox2.ListCount = 1 Then
Me.Combox2.Value = Me.Combox2.Column(0)
End If



Thanks
 
Ad

Advertisements

K

Ken Snell [MVP]

See my reply to your first post with this same question.
 
A

Andi Mayer

I have a form that has 2 combo boxes on it. The selections for combox2
dynamicly change based on what is selected from combox1. If combox2 only
has a single selection available, I want to automatically have combox2 use
it without me type anything. How can I do this?

I thought I could do the following, but it doesn't do what I want. I made
sure "Column Heads" is set to No. I know the "If" condition has been met,
because I traced the execution, but I never see the Value appear in
combox2.

If Me.Combox2.ListCount = 1 Then
Me.Combox2.Value = Me.Combox2.Column(0)
End If
do you mean?
If Me.Combox2.ListCount = 1 Then
Me.Combox2.Value = Me.Combox2.ItemData(0)
End If
 
J

Jay Wilson

See my reply to your first post with this same question.
Ken

I appoligize. My news server never showed the first posting going out
successfully and it never saw your response. Would you please repost your
response?

Thank You
 
Ad

Advertisements

K

Ken Snell [MVP]

Here it what I'd posted earlier:

Try this to set the combo box to the first item in the list:

Me.ComboBox2.Value = Me.ComboBox2.ItemData(0)
--

Ken Snell
<MS ACCESS MVP>
 

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