Results 1 to 3 of 3
  1. #1
    umpersav is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    2

    Help using 2 combo boxes to filter form

    Hello all,



    I am new to posting on the forum but have been lurking for a little while now. I am trying to resurrect an old database but need some help.

    Using 2 comboboxes, I want users to select the document type (Form, policy, manual etc) and Department . I have called these comboboxes: cbotypefilter and cbodeptfilter. The field names are Type and Dept

    Ideally, I want users to select from each combo box and have my multiple item form show all the selected type files we have pertaining to that department. (ex, if user selects policy for accouting- the filter will bring up all policies related to accounting)

    I am not great with database, its been almost 10 years since I took a university class, so I need some help with the code. This is what my thought process is:

    If Me.cbotypefilter <> "" Then
    If Me.cbodeptfilter <> "" Then
    Me.Filter = Some code that states to filter based on Type from cbotypefilter and Dept from cbodeptfilter
    Me.FilterOn = True

    Else (filter based on just type alone- is this code right?)
    Me.Filter = "Type = """ & Me.cbotypefilter & """"
    Me.FilterOn = True
    End If

    Else
    If Me.cbodeptfilter <> "" Then *Is this code right? filter based on department only?
    Me.Filter = "Dept = """ & Me.cbodeptfilter & """"
    Me.FilterOn = True
    Else
    Me.Filter = ""
    Me.FilterOn = False
    End If
    End If

    Any help is greatly appreciated, I'm practically lost on this stuff. I've exhausted google and I don't know enough about the code to know what I'm doing exactly. I think my thought process is good but I don't know the syntax.

  2. #2
    umpersav is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    2
    I forgot to mention, all this code is stored on a button. so when the user clicks the command button this will all execute.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Split form filter via combo boxes
    By killermonkey in forum Forms
    Replies: 3
    Last Post: 03-21-2013, 12:37 PM
  2. Filter Reports Using Combo Boxes on Pop-Up Form
    By besuchanko in forum Reports
    Replies: 12
    Last Post: 02-18-2013, 04:20 PM
  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 Report by Form using combo boxes
    By TubbzUK in forum Reports
    Replies: 3
    Last Post: 12-11-2012, 01:18 PM
  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