Results 1 to 4 of 4
  1. #1
    raffi is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    Inside a Sub Procedure
    Posts
    88

    2 Filters on 1 datasheet

    hello, i have a database with Item Table with the following fields itemCode, Description, Utility



    what i did was i implemented the following VB indicated below in a combo-box within a split-form where the source code is the item table

    Code:
    Private Sub CboFilter_Change()
      
      If Nz(Me.CboFilter.Text) = "" Then
        Me.Form.Filter = ""
        Me.FilterOn = False
        
       ElseIf Me.CboFilter.ListIndex <> -1 Then
        Me.Form.Filter = "[Utility] = '" & _
                         Replace(Me.CboFilter.Text, "'", "'") & "'"
        Me.FilterOn = True
        
    
    
      Else
        Me.Form.Filter = "[Utility] Like '*" & _
                         Replace(Me.CboFilter.Text, "'", "'") & "*'"
        Me.FilterOn = True
        
        End If
        
      Me.CboFilter.SetFocus
      Me.CboFilter.SelStart = Len(Me.CboFilter.Text)
    
    
    End Sub
    meaning whatever i type in the combo-box, will be filtered by the utility field, of the datasheet in the split form, this is ok an all

    im looking for a way to add a second combo-box, and filter the description field, within the same datasheet, much like what im doing with the Utility Field but however without restarting the filter again

    in other words, i don't want the 2 combo-box's Filters to cancel each other out, in the datasheet which they are filtering in the split form
    in other words, i want to freeze the datasheet after filtering the Utility, so i may filter the description with in an already filtered by utility Datasheet,

    thanks in advance

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,928
    Apply both combobox inputs to the filter criteria. Review http://www.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.

  3. #3
    raffi is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    Inside a Sub Procedure
    Posts
    88
    maybe we can hold down the filter toggle in the form, on the first combo-box after update event
    maybe we can set to the other combo-box to not clear the filter on the datasheet by setting a before update event

    or we can say, once the filter has been applied it will remain applied unless i click remove filter using RemoveFilter Button

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,928
    Filtering records with code doesn't work like that.

    Must use both combobox inputs to construct filter criteria and apply to Filter property.
    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: 0
    Last Post: 10-03-2013, 09:53 PM
  2. Replies: 8
    Last Post: 08-26-2012, 11:11 PM
  3. Replies: 4
    Last Post: 05-04-2012, 03:41 PM
  4. Help with filters
    By daltman1967 in forum Forms
    Replies: 5
    Last Post: 07-14-2011, 02:12 PM
  5. Replies: 3
    Last Post: 09-15-2010, 12:35 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