Results 1 to 3 of 3
  1. #1
    hascons is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    9

    Report Filter Statement

    Hello Everyone,

    I'm having a problem building out a filter statement when the it needs to determine if a Boolean was Passed



    I've attached a photo showing the code in breakmode and stepping through the code. For some reason the code will not pick up when I've entered a "Yes" or "NO".

    I've tried using the standard "<>" at first to determine if the value of the textbox = "Yes" or "No" but neither of these options work.

    This Textbox is part of an Unbound Access Form that acts as a report Builder to filter reports so there is no recordset attached to any of the texboxes. I need to remove the Single quotes around the Words "Yes" or "No" when the filter is expecting a Boolean type variable. I can do this manually but would rather be able to Identify the text as Boolean with a simple "Yes" or "No" and build string accordingly.
    Attached Thumbnails Attached Thumbnails 2022-06-03.jpg  

  2. #2
    hascons is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    9
    I did find the solution to this problem

    I Used The Following Code

    Code:
    If Len(Trim(Me.f2_FilterField) & vbNullString) > 0 And Len(Trim(Me.f2_Value) & vbNullString) > 0 Then
        
            If Me.f2_Value <> True Then
          
                If Len(sSql) > 6 Then
                    sSql = sSql & " AND " & Me.f2_FilterField & "= '" & Me.f2_Value & "'"
                Else
                    sSql = sSql & Me.f2_FilterField & "= '" & Me.f2_Value & "'"
                End If
                
            ElseIf Me.f2_Value = True Then
        
                If Len(sSql) > 6 Then
                    sSql = sSql & " AND " & Me.f2_FilterField & "= " & Me.f2_Value
                Else
                    sSql = sSql & Me.f2_FilterField & "= " & Me.f2_Value
                End If
            
            End If
        
        End If

  3. #3
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,410
    Try

    If Not me.f2_value = "Yes" AND Not me.f2_Value = "No" Then

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

Similar Threads

  1. Replies: 7
    Last Post: 12-30-2021, 02:29 PM
  2. Filter or "where" statement for totals in report
    By msmithtlh in forum Reports
    Replies: 1
    Last Post: 04-12-2016, 01:55 PM
  3. Replies: 6
    Last Post: 02-27-2014, 08:06 PM
  4. Me.Filter statement problem.
    By BobG in forum Programming
    Replies: 2
    Last Post: 11-19-2010, 10:25 AM
  5. Query filter statement
    By Brian62 in forum Access
    Replies: 1
    Last Post: 02-16-2010, 02:34 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