Results 1 to 3 of 3
  1. #1
    AccessPower's Avatar
    AccessPower is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    165

    Filtering NavigationSubform in VBA

    So I have the following code that works pretty well when I use it with a regular subform; however, when I modified the code to try it with a navigation subform, it no longer works.

    Any ideas?




    Code:
    Dim strFilter As String
    
    'Cases for the filter. Limits to list.
    Select Case Me.cboFilter
        Case "Unavailable"
            strFilter = "CheckoutDate IS NOT NULL"
        Case "Available"
            strFilter = "CheckoutDate IS NULL AND SerialNumber <> ''"
        Case "No Filter"
            strFilter = ""
        Case Else
            MsgBox "Invalid Filter"
            strFilter = ""
    End Select
    
    
    'Apply filter
    If strFilter <> "" Then
        Me.NavigationSubform.Form.Filter = strFilter
        Me.NavigationSubform.Form.Filter = True
    Else
        Me.NavigationSubform.Form.Filter = ""
        Me.NavigationSubform.Form.Filter = False
    End If

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,400
    surprised it works as you've posted - this

    Me.NavigationSubform.Form.Filter = False

    should be

    Me.NavigationSubform.Form.FilterOn = True

  3. #3
    AccessPower's Avatar
    AccessPower is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    165
    Copy and Paste errors...

    My eyeballs were about to fall out trying to see what was wrong.

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

Similar Threads

  1. Replies: 8
    Last Post: 02-22-2016, 11:22 AM
  2. Replies: 5
    Last Post: 08-08-2013, 06:20 PM
  3. NavigationSubform Not Populating Records
    By altemir in forum Forms
    Replies: 3
    Last Post: 04-30-2012, 03:19 PM
  4. Replies: 0
    Last Post: 02-15-2011, 01:43 PM
  5. Replies: 2
    Last Post: 12-17-2010, 11:12 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