synchronizing 2 combo boxes on a form Pt2

S

sashabaz

Hi all...

I am currently trying to synchronize 2 combo boxes on a form. The 2 boxes
are called Studio and Project. Here is a break down of the design.

Tables:
Studio (storing studio names)
Project (storing project information)
StudioProject (linking studio and project tables so projects can be
assigned/linked to a studio, foreign keys are studio[text], project[text])
Staff (linked to the StudioProject table)

Form:
Staff (allows user to enter staff information i.e. their studio and which
project they are on).

On the form I have 2 combo boxes: cboStudio; cboProject. I want the choice
of studio to limit the choice of project.

- The row source for cboStudio is:
SELECT StudioProject.StudioProjectID, StudioProject.Studio FROM
StudioProject ORDER BY StudioProject.Studio;

- The AfterUpdate() in cboStudio is:
Private Sub cboStudio_AfterUpdate()
Me.Combo2.Requery
Me.Combo2.SetFocus
Me.Combo2.Dropdown
End Sub

- Then in cboProject I have:
SELECT StudioProject.StudioProjectID, StudioProject.Project FROM
StudioProject WHERE StudioProject.Studio = Form![cboStudio] ORDER BY
StudioProject.Project;
 
R

Rick Brandt

sashabaz said:
Hi all...

I am currently trying to synchronize 2 combo boxes on a form. The 2 boxes
are called Studio and Project. Here is a break down of the design.

Tables:
Studio (storing studio names)
Project (storing project information)
StudioProject (linking studio and project tables so projects can be
assigned/linked to a studio, foreign keys are studio[text], project[text])
Staff (linked to the StudioProject table)

Form:
Staff (allows user to enter staff information i.e. their studio and which
project they are on).

On the form I have 2 combo boxes: cboStudio; cboProject. I want the choice
of studio to limit the choice of project.

- The row source for cboStudio is:
SELECT StudioProject.StudioProjectID, StudioProject.Studio FROM
StudioProject ORDER BY StudioProject.Studio;

- The AfterUpdate() in cboStudio is:
Private Sub cboStudio_AfterUpdate()
Me.Combo2.Requery
Me.Combo2.SetFocus
Me.Combo2.Dropdown
End Sub

You code is referring to Combo2 and needs to refer to cboProject.
 

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