updating combo box content

  • Thread starter the_dude via AccessMonster.com
  • Start date
T

the_dude via AccessMonster.com

Dear all,

I have a form woth two combo boxes. Number 1 is for a family name, which is
looked up in a table. Number 2 is for members of the family. I want the
second combo box to only show the member names for the family in combo box 1,
not all member names possibe. Therefore, I have created a query and linked
that to combo box 2. When i run the form and look up the first family it
works fine. However, if i change my mind and want to look up another family
it still shows the previous results in combo box 2.
How do I get to update combo box 2 if i change the value in combo box 1?
Someone mentioned something about adding to the VBA to close the form and
then open it again but i am not sure how to do that or if that wouold solve
the problem.

I would appreciate any help.

the_dude
 
J

John Spencer

Add code to combobox 1's after update event that will requery combobox 2

Something like the following

Private Sub Combo1_AfterUpdate()
Me.Combo2.Requery
End Sub


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
T

the_dude via AccessMonster.com

Thanks John,

I have tried it and it works a treat.

Many thanks,

Olli

John said:
Add code to combobox 1's after update event that will requery combobox 2

Something like the following

Private Sub Combo1_AfterUpdate()
Me.Combo2.Requery
End Sub
Dear all,
[quoted text clipped - 17 lines]
 

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