Cascading ComboBoxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lee123
    Contributor
    • Feb 2007
    • 556

    #1

    Cascading ComboBoxes

    Hello its been a while since i have come to this web site and its been a while since i have done any programming but here i am. my question is going to be difficult to explain but here it goes. i have been trying to make a auto parts database but i cant get it to cascade the parts i need for certain cars and years.

    in my database i have 6 Comboboxes on an unbound form each one drills down to the next one as it suppose to but when i change to a different make of a car i cant seem to get the parts to show up for that make.

    as you may have guessed i have six tables.

    Years - YearID, Year
    Make - MakeID, YearID, Make
    Model - ModelID, MakeID, YearID, Model
    Engine - EngineID, YearID, MakeID, ModelID, Engine
    ReplacementPart s - ReplacementID, YearID, MakeID, ModelID, EngineID, ReplacementPart
    Parts - PartsID, ReplacementPart sID, YearID, MakeID, ModelID, EngineID, Part, PartNumber

    My Codes I Have behind Them Is This:


    Code:
    Private Sub EngineCombo_AfterUpdate()
        ReplacementPartsCombo.RowSource = "SELECT ReplacementPartsID,YearID,MakeID,ModelID,EngineID,ReplacementPart FROM ReplacementPartsT WHERE YearID=" & EngineCombo
    End Sub
    Private Sub MakeCombo_AfterUpdate()
        ModelCombo.RowSource = "SELECT ModelID,MakeID,YearID,Model FROM ModelT WHERE makeID=" & MakeCombo
        ModelCombo.SetFocus
        ModelCombo.Dropdown
    End Sub
    Private Sub ModelCombo_AfterUpdate()
        EngineCombo.RowSource = "SELECT EngineID,YearID,MakeID,ModelID,Engine FROM EngineT WHERE MODELID=" & ModelCombo
        EngineCombo.SetFocus
        EngineCombo.Dropdown
    End Sub
    Private Sub ReplacementPartsCombo_AfterUpdate()
        PartsCombo.RowSource = "SELECT PartsID,ReplacementPartsID,YearID,MakeID,ModelID,EngineID,Parts,PartNumber,Price,Core,Store,Phone,City,State FROM PartsT WHERE  EngineID=" & ReplacementPartsCombo
    End Sub
    Private Sub YearCombo_AfterUpdate()
        MakeCombo.RowSource = "SELECT MakeID,YearID,Make FROM MakeT WHERE YearID=" & YearCombo
        MakeCombo.SetFocus
        MakeCombo.Dropdown
    End Sub
    If you someone can take the time and look at this and see if you can help me out i would appriciate it very much. Oh I Am using Access 2000 Developers

    lee123
    Last edited by lee123; Oct 18 '11, 09:32 PM. Reason: Some information Forgotten
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    You should find something to help with this in Cascaded Form Filtering.

    Comment

    • lee123
      Contributor
      • Feb 2007
      • 556

      #3
      Thanks You I'll Try This..

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        8-). Have a real play around with the illustration database. I expect once you've explored a bit you'll find you can adapt the concepts to your own database quite straightforward ly (but if you have any problems still then let us know here and we'll do what we can for you of course).

        Comment

        Working...