Results 1 to 6 of 6
  1. #1
    Rezun is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2020
    Posts
    3

    Combo box filtering

    Hi,

    I all


    I have problem with my small app.
    I need to make that top 5 combo-boxes to filter data in a table but in a way that you can apply all 5 at the same time.
    I tried to find a way but nothing is working. Please help !

    Part tracker.zip

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    build the 'where' clause by cycling thru all the controls....
    it executes after a find button CLICK event
    if null, ignore.
    if not, apply.


    Code:
    '----------------
    sub btnFilter_click()
    '----------------
    dim sWhere as string 
    
    
    sWhere = "1=1"
    if not IsNUll(cboST) then sWhere = sWhere & " and [State]='" & cboST & "'"
    if not IsNUll(cboCity) then sWhere = sWhere & " and [city]='" & cboCity & "'"
    if not IsNUll(cboZip) then sWhere = sWhere & " and [ZipCode]='" & cboZip & "'"
    
    
    If sWhere = "1=1" Then
      Me.FilterOn = False
    Else
      Me.Filter = sWhere
      Me.FilterOn = True
    End If
    end sub

  3. #3
    Rezun is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2020
    Posts
    3
    Hi ranman256,

    Thank you for you help.
    I forgot to add that I am just starting my adventure with Access.
    Will you be able to create a code for that one column. Sorry for trouble but this thing is just getting my crazy.

    Click image for larger version. 

Name:	Clipboard01.jpg 
Views:	12 
Size:	16.1 KB 
ID:	42030

    Kind Regards,

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    create a code? Your column is full of codes.

  5. #5
    Rezun is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2020
    Posts
    3
    There is code but it is not working.
    Is there a way to use macro builder and applyfilter option to make that bombo box to filter that data ?


  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Did you try adapting code example ranman provided?

    For more info on building a search form, review http://allenbrowne.com/ser-62.html
    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. Replies: 2
    Last Post: 06-17-2018, 12:07 AM
  2. Replies: 3
    Last Post: 07-04-2017, 07:22 AM
  3. Replies: 1
    Last Post: 07-12-2012, 08:39 AM
  4. Replies: 5
    Last Post: 03-12-2012, 02:58 AM
  5. Replies: 0
    Last Post: 08-17-2008, 12:19 PM

Tags for this Thread

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