Results 1 to 4 of 4
  1. #1
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44

    Filter with multiple Combo boxes

    Good day.

    I search high and low, tried various examples I had found, but I can't seem to accomplish this.

    I have my main form (frmTeamRoster) with two combo boxes:
    - Name of 1st box = "Team", row source is a list of teams from tblTeams (SELECT tblTeams.Team FROM tblTeams ORDER BY Team)
    - Name of 2nd box = "Season", row source is a list of teams from tblSeasons (SELECT tblSeasons.Season FROM tblSeasons ORDER BY Season)

    On the main form, is a sub form (subfrmTeamRoster) which is in datasheet view where its Record Source is from qryTeamRoster. In this query, both "Team" and "Season" fields come from tblPlayerStats. Other fields within this query are (Player) "Name", (Jersey) "Number", and "Position" which comes from tblPlayerInfo.

    I'm able to filter the sub form by Team using the Team combo box, but I can't break down the datasheet further by Season. The datasheet results give me the Team roster according to what the Team combo box indicates, but gives me all the players regardless of the Season (ex. 2015-16, 2016-17, etc).

    Any help is appreciated.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    subfrmTeamRoster form should be connected to the master form via cboTeam and cboSeason
    subfrmTeamRoster properties:
    LINK MASTER FIELDS: cboTeam;cboSeason
    LINK CHILD FIELDS:cboTeam;cboSeason

    once you change the combos, the subform data should change automatically.

  3. #3
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44
    This didn't do it. But I did change your suggestion to this:
    Link Master Fields: Team;Season
    Link Child Fields: Team;Season

    But this also didn't work. One thing to point out is I have nothing in After Update events in the combo boxes. If this is required, what would I put?

  4. #4
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44
    I got it!!!

    I left the Master and Child Fields both as "Team".

    Then in the Season combo box's After Update event, I used the following:

    Private Sub Season_AfterUpdate()
    Me.subfrmTeamRoster.Form.Filter = "Season=""" & Me.Season & """"
    Me.subfrmTeamRoster.Form.FilterOn = True
    End Sub

    Works like a charm.

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

Similar Threads

  1. Replies: 3
    Last Post: 09-28-2015, 08:17 PM
  2. Filter listbox, using combo boxes
    By EthanMoist in forum Forms
    Replies: 8
    Last Post: 05-22-2013, 11:36 AM
  3. Filter a Form with Multiple Combo Boxes
    By Njliven in forum Forms
    Replies: 6
    Last Post: 01-03-2013, 01:25 PM
  4. Filter based on two combo boxes.
    By jakeao in forum Programming
    Replies: 1
    Last Post: 05-22-2011, 10:56 AM
  5. Filter form from multiple combo boxes
    By Bird_FAT in forum Programming
    Replies: 6
    Last Post: 05-19-2010, 09:32 AM

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