Results 1 to 3 of 3
  1. #1
    Mariner81 is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2023
    Posts
    13

    Strange R-n Time Error applying Form Filter to Subform

    I'm trying to filter a subform based on a checkbox on my main form. My main forms name is frmCrewInfo, and the subforms name is subCrewDocs. I'm trying to filter the subform by a field called IsActive which utilizes a checkbox (true/false) field on the form. I'm attempting to use the .Form.Filter property.

    Here is what I have written



    Code:
    Private Sub chkShow_Click()
        If Me.chkShow = True Then
            Me.[subCrewDocs].Form.FilterOn = False
        Else
            Me.[subCrewDocs].Form.Filter = "IsActive = 'Yes'"
            Me.[subCrewDocs].Form.FilterOn = True
        End If
    End Sub

    I get the following:

    "Run Time Error '2645": Vessel Matrix can't find the field '|1' referred to in your expression.

    This seems very odd because i have not typed a vertical bar and a one anywhere in the procedure or module as the message states. I can't figure out what the heck is going on here. Very bizarre!

    Any thoughts?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,899
    If IsActive is a Yes/No field, it saves numeric data (0, -1) not text ('Yes', 'No'). Don't use 'Yes', use True or -1.

    = "IsActive = True"

    or

    = "IsActive = -1"

    or simply

    = "IsActive"
    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
    Mariner81 is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2023
    Posts
    13
    Thank you for pointing out my oversight.

    I found the problem and it was a naming error between the subform control and the subform itself. I'm just getting back into this after a 15 year hiatus and have re-learn everything the hard way....namely by banging my head against the wall and finding my careless mistakes.

    Thanks again for the timely response.

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

Similar Threads

  1. Subform filter applying to wrong field
    By Jobadiah in forum Forms
    Replies: 3
    Last Post: 02-27-2023, 10:21 AM
  2. Replies: 2
    Last Post: 07-09-2018, 10:08 AM
  3. Applying a filter in a form
    By 2410Davie in forum Forms
    Replies: 1
    Last Post: 03-07-2016, 03:35 PM
  4. Replies: 4
    Last Post: 04-22-2013, 06:45 AM
  5. Access Reports - Applying a subform filter
    By AMCUser in forum Queries
    Replies: 13
    Last Post: 06-25-2010, 07:32 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