3 Synchronized Combo Boxes

S

Sarah Huibregtse

I have been struggling to add a 3rd combo box to my first two synchronized combo boxes. Please help!! Here is what I've done so far:

I have 3 tables (Course, Session, Topic)

The first Combo Box is pulling from the Course table with no issues. In the AfterUpdate I have the following code:

Private Sub cboCourse_AfterUpdate()
Me.cboSession.RowSource = "SELECT SessionTitle FROM " & _
" Session WHERE CourseID = " & Me.cboCourse & _
" ORDER BY SessionTitle "
Me.cboSession = Me.cboSession.ItemData(0)
End Sub

Works perfectly with the 2nd Combo Box. :) Then I took that same code and added it to the 2nd Combo Box's After Update. However, when I leave the WHERE in it I get no results. If I take the WHERE out I get all Topics from my table.

Private Sub cboSession_AfterUpdate()
Me.cboTopic.RowSource = "SELECT TopicTitle FROM " & _
" Topic WHERE SessionID = " & Me.cboSession
Me.cboTopic = Me.cboTopic.ItemData(0)
End Sub

So basicly I know that my WHERE statement is correctly coded. I've tried referencing the Form fields too and haven't been successful.

Please help! This is my first attempt at this detailed of a database and I'm getting very frustrated. :(

Thanks!!
Sarah

EggHeadCafe - Software Developer Portal of Choice
WPF And The Model View View Model Pattern
http://www.eggheadcafe.com/tutorial...b-7374d3da3425/wpf-and-the-model-view-vi.aspx
 
J

Jeff Boyce

"How" depends on "what"...

What are the primary and foreign keys for those three tables?

Will having Access "know" the SessionID (alone) be sufficient for it to find
the related topics, or does your Topic table have BOTH SessionID and
CourseID foreign keys?

Regards

Jeff Boyce
Microsoft Office/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