Results 1 to 8 of 8
  1. #1
    Andyjones is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76

    Need help with cascade access 2010

    I Really Need this resolving but am stuck.



    I have 3 combo boxes 1 called league type one called ourteams and one called opp teams

    The cascading effect works for our teams but i cant get it to work for opp teams can anyone have a look and correct this for me please.

    When you select the league type it shoud show the teams to select in our team and opp team for that league.
    No good at coding so if someone could get this to work I would be very greatfull make any any changes you need



  2. #2
    GAccess is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    38
    I dont have utteraccess, but I can give you a generic example of what you need to do, depending on how many cascading combo's you have. Let me know.

  3. #3
    Andyjones is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76
    trythis link
    Attached Files Attached Files

  4. #4
    GAccess is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    38
    Hi andy,

    This is what you have


    Private Sub cboLeague_AfterUpdate()
    Dim sSource As String
    sSource = "SELECT tblLeagueTeams.LeagueTeamID, tblLeagueTeams.LeagueID, tblLeagueTeams.Team, tblLeagueTeams.Div " & _
    "FROM tblLeagueTeams " & "WHERE [LeagueID] = " & Me.cboLeague
    Me.cboTeam.RowSource = sSource
    Me.OurTeamID = Me.cboTeam.Column(2)
    End Sub

    Private Sub cboTeam_AfterUpdate()
    Me.txtDiv = Me.cboTeam.Column(3)
    End Sub
    Private Sub Form_Load()
    DoCmd.Maximize
    End Sub
    You need to also place the requery and set focus commands in each afterupdate of your combos respectively.

    There are some video tips lingering around here somewhere.. but this is simple enough for me to help you with now.. I THINK .. cause I'm new fairly new to VBA database as well.

    I will not be using select queries in this because I am strictly using VBA. If you want to use select etc. you can always try searching through the forum for that video : it provides tips in using the query creator. Unfortunately, I cannot find that link right now.

    Try this and let me know if it works



    Private Sub cboLeague_AfterUpdate()

    Me.cboTeam = null
    Me.cboOurTeam = null

    Me.cboTeam.Requery
    Me.cboOurTeam.Requery

    Me.cboTeam.SetFocus

    End Sub

    Private Sub cboTeam_AfterUpdate()
    Me.cboOurTeam = null
    Me.cboOurTeam.Requery

    End Sub




    To explain the above.. you simply want the user to choose the first combo box.. which would control the choices in the second and third combo box.

    Once the user chooses the first combo box... options will be populated strictly based off of the choice of the first combo box in the 2nd combo box. Once an option is chosen in the 2nd combo box.. choices will be available to the user based off of the selection in the 2nd combo box. The requery command allows the choices in both the 2nd and 3rd combo box to change depending on previous selections. The setfocus command forces access to focus on a chosen combo box.

    The code that is up there only works if combo 3 is dependent on combo 2, and combo 2 and 3 are dependent on combo 1. if not hopefully you can play around with it , or someone more experienced can help.

  5. #5
    Andyjones is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76
    Hi I have tried what you have sujested and I keep getting a compiler error
    Attached Files Attached Files

  6. #6
    GAccess is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    38
    Me.cboOppositionTeam seems to be the problem. Replace cboOppositionTeam with the name of the combo box you are wanting.


    Check the actual name of your combo box. Make sure spelling is correct etc.

  7. #7
    Andyjones is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76

    HI

    Ok the code i have coppied in seems to be working but if you look at last zip and see how league type cascades the ourteam drop down I need the same cascade effect to work for opp team combo
    Attached Files Attached Files
    Last edited by Andyjones; 04-14-2012 at 06:33 AM.

  8. #8
    GAccess is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    38
    Quote Originally Posted by Andyjones View Post
    Ok the code i have coppied in seems to be working but if you look at last zip and see how league type cascades the ourteam drop down I need the same cascade effect to work for opp team combo
    each person's name that you would like to show up when you choose an item in the combo box also needs to be re queried. Use the same method as you used to get the main boxes working. Hope that made sense.

    Other words, each name box must be re queried. So just use the .Requery command for each one .

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 05-07-2013, 08:37 PM
  2. Replies: 1
    Last Post: 01-05-2012, 02:34 PM
  3. Cascade of 3 or more ComboBoxes
    By tomullus in forum Forms
    Replies: 4
    Last Post: 10-08-2011, 06:22 PM
  4. Cascade Lookup or drop down - 2010
    By Tablerone in forum Access
    Replies: 14
    Last Post: 10-04-2011, 04:18 PM
  5. Replies: 17
    Last Post: 08-03-2011, 05:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums