Automatic Population

T

Tony

Hi,
I have a problem which hopefully someone can help with. I
have several combo boxes on my form. The first is for
each director. Each director can only belong in one
region and one division. So I would like to have the
region and division automatically populate when I select
the director. Please let me know how this is
accomplished.

A million Thanks.
 
D

Douglas J. Steele

Make sure that the query that populates your combobox contains both the
Region and Division for each Director. In the AfterUpdate event of the
combobox, put code like:

Me.txtRegion = Me.cboDirector.Column(1)
Me.txtDivision = Me.cboDirector.Column(2)

(This assumes that that Region is the 2nd column in the query, and the
Division is the 3rd column)
 
J

John Vinson

Hi,
I have a problem which hopefully someone can help with. I
have several combo boxes on my form. The first is for
each director. Each director can only belong in one
region and one division. So I would like to have the
region and division automatically populate when I select
the director. Please let me know how this is
accomplished.

A million Thanks.

You can use the AfterUpdate event of the director combo to set the
other two. It might be simplest to include the region (or RegionID)
and division (or DivisionID) in the combo's RowSource and use code
like

Private Sub cboDirector_AfterUpdate()
Me!cboRegion = Me!cboDirector.Column(2)
Me!cboDivision = Me!cboDirector.Column(3)
End Sub

The Column property is zero based so this will put the third and
fourth columns of the query into the respective combos.

HOWEVER... if the region and the division can be unambiguously
determined from the identity of the director, I wonder if they should
be stored in this table at all?
 

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