Auto Expand a Combobox

I

Iram

Hello,
I have a subform with some fields, in particular, Category and Sub-Category.
Both of these are Comboboxes.
After Updating the Category Combobox I need the Sub-Category combobox to
automatically Open/expand. The problem is people are selecting a Category but
forgetting to check to see if there is a related Sub-Category thus this is
why I want the Sub-Category to Expand the drop down list.

Is this possible? If so how can I do this?



Thanks.
Iram/mcp
 
S

Stuart McCall

Iram said:
Hello,
I have a subform with some fields, in particular, Category and
Sub-Category.
Both of these are Comboboxes.
After Updating the Category Combobox I need the Sub-Category combobox to
automatically Open/expand. The problem is people are selecting a Category
but
forgetting to check to see if there is a related Sub-Category thus this is
why I want the Sub-Category to Expand the drop down list.

Is this possible? If so how can I do this?



Thanks.
Iram/mcp

Me.ComboName.DropDown

in the 1st combo's AfterUpdate event ought to do it.
 
I

Iram

I am getting a run-time error '2185', "You can't reference a property or
method for a control unless the control has the focus.

On the "Category" field, After Update I have this...

Private Sub Category_AfterUpdate()
Me.Sub_Cat.Requery
Me.Sub_Cat.Dropdown (this part becomes yellow when I debug the above error)
End Sub

re-cap
After I update the Category field I need the Sub_Cat field to open its drop
down menu.



Thanks.
Iram
 
J

John W. Vinson

I am getting a run-time error '2185', "You can't reference a property or
method for a control unless the control has the focus.

So set focus to it:

Private Sub Category_AfterUpdate()
Me.Sub_Cat.Requery
Me.Sub_Cat.SetFocus
Me.Sub_Cat.Dropdown (this part becomes yellow when I debug the above error)
End Sub
 

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