Results 1 to 5 of 5
  1. #1
    dotcanada is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44

    Filter subform with two combo boxes

    Hi all.



    First post on this forum. Not entirely new to access but still consider myself a novice and learning a lot.

    I'm building a hockey player database which shows what team they're on and other stats. I'm created a form (frmTeamStats) which has a subform (in datasheet view) and two combo boxes on the main form. The datasheet lists the player, the season (ie 2014-15), and their stats. I would like one combo box to list of teams in the league and the second to filter the list by season. Is this possible?

    Thanks in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    In a continuous record form,.user clicks the team, cboTeam,
    the data gets filtered in cboTeam_afterupdate event
    Code:
    me.filter = "[team]='" & cboTeam & "'"
    me.filterOn = true
    If you want to further filter year,
    Code:
    me.filter = "[team]='" & cboTeam & "' and [year] =" & cboYear 
    me.filterOn = true
    select a row, (player) , click the btnDetail button,
    this will open the single record form to show the player details
    docmd.openform "frmPlayer",,,"[playerID] = " & txtID

    In a single record form,frmPlayer, an in the header is a combo cboYear
    in cboYear_afterupdate event, you can filter the subform data with filter like above but be sure to use the path to the subform

  3. #3
    dotcanada is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44
    Thanks for the quick reply.
    I placed in the second coding for the combo box. But there is a bug. I've attached my dbase. The form I'm trying to work on is frmTeamStats. I'm sure there are a few mistakes within the dbase (relationships, etc.)
    Attached Files Attached Files

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    I cant open standing. You have it connected to linked excel file which i dont have.
    your forms should not be connected to excel files (for this reason)

    Is your propblem in the PLAYER INFO button, or STANDINGS?

  5. #5
    dotcanada is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44
    The Standings option is not an issue. It is with the frmTeamStats and getting the second combobox to work (cboSeason). The first combobox (cboTeam) currently works and brings up the the players and their stats, but I want to filter down the list according to the season.

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

Similar Threads

  1. Help using 2 combo boxes to filter form
    By umpersav in forum Programming
    Replies: 2
    Last Post: 07-13-2015, 12:29 PM
  2. Replies: 9
    Last Post: 07-03-2014, 12:00 PM
  3. Me.filter with datepart from 2 combo boxes?
    By wackywoo105 in forum Programming
    Replies: 3
    Last Post: 03-15-2014, 06:36 PM
  4. how to filter data using two combo boxes?
    By jasonix in forum Reports
    Replies: 3
    Last Post: 11-21-2011, 03:04 AM
  5. Filter based on two combo boxes.
    By jakeao in forum Programming
    Replies: 1
    Last Post: 05-22-2011, 10:56 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