Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 38
  1. #16
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    I currently have this written in the code, I am assuming it is private sub, how would you make sure it is pointed to list box on Form B?



    Code:
    Private Sub Refilter()    
        Dim strFilterString As String
    
    
        'BUILD THE FILTER STRING:
        If Forms("002_Criteria").CKNFixer = True Then
            strFilterString = strFilterString & " OR NFixer ='True'"
        End If
        
        If Forms("002_Criteria").CkSun = True Then
            strFilterString = strFilterString & " OR TolerantSun ='True'"
        End If
        
        If Forms("002_Criteria").CKShade = True Then
            strFilterString = strFilterString & " OR TolerantShade ='True'"
        End If
        
        If Forms("002_Criteria").CKWind = True Then
            strFilterString = strFilterString & " OR TolerantWind ='True'"
        End If
        
        If Forms("002_Criteria").CkSalt = True Then
            strFilterString = strFilterString & " OR TolerantSalt ='True'"
        End If
        
        If Forms("002_Criteria").CkPollinator = True Then
            strFilterString = strFilterString & " OR Pollinator ='True'"
        End If
        
        If Forms("002_Criteria").CkNative = True Then
            strFilterString = strFilterString & " OR Native ='True'"
        End If
        
        If Forms("002_Criteria").CKIntroduce = True Then
            strFilterString = strFilterString & " OR introduce ='True'"
        End If
        
        'REMOVE LEADING " OR " ON FILTER STRING:
        If strFilterString <> "" Then strFilterString = Mid(strFilterString, 5)
        
        'APPLY FILTER STRING TO 003_Species:
        If strFilterString <> "" Then
            Forms("003_Species").ListSciName.RowSource = "SELECT * FROM [qSciName] WHERE " & strFilterString
        Else
            Forms("003_Species").ListSciName.RowSource = "qSciName"
        End If
    
    
    End Sub

  2. #17
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #18
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Your code should not have quotes around True.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    Quote Originally Posted by pbaldy View Post
    Your code should not have quotes around True.
    I will try remove that, sent an email. Don't see any options to attach file.

  5. #20
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    I have removed the quotes, still nothing happens

    Code:
    Private Sub Refilter()    
        Dim strFilterString As String
    
    
        'BUILD THE FILTER STRING:
        If Forms("002_Criteria").CKNFixer = True Then
            strFilterString = strFilterString & " OR NFixer = True"
        End If
        
        If Forms("002_Criteria").CkSun = True Then
            strFilterString = strFilterString & " OR TolerantSun = True"
        End If
        
        If Forms("002_Criteria").CKShade = True Then
            strFilterString = strFilterString & " OR TolerantShade = True"
        End If
        
        If Forms("002_Criteria").CKWind = True Then
            strFilterString = strFilterString & " OR TolerantWind = True"
        End If
        
        If Forms("002_Criteria").CkSalt = True Then
            strFilterString = strFilterString & " OR TolerantSalt = True"
        End If
        
        If Forms("002_Criteria").CkPollinator = True Then
            strFilterString = strFilterString & " OR Pollinator = True"
        End If
        
        If Forms("002_Criteria").CkNative = True Then
            strFilterString = strFilterString & " OR Native = True"
        End If
        
        If Forms("002_Criteria").CKIntroduce = True Then
            strFilterString = strFilterString & " OR introduce = True"
        End If
        
        'REMOVE LEADING " OR " ON FILTER STRING:
        If strFilterString <> "" Then strFilterString = Mid(strFilterString, 5)
        
        'APPLY FILTER STRING TO 003_Species:
        If strFilterString <> "" Then
            Forms("003_Species").ListSciName.RowSource = "SELECT * FROM [qSciName] WHERE " & strFilterString
        Else
            Forms("003_Species").ListSciName.RowSource = "qSciName"
        End If
    
    
    End Sub

  6. #21
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Sent instructions on how to attach.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #22
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Not sure why the last 2 -3 posts weren't visible when I wrote this. Oh well, best to let it stand I guess.
    Good luck; you're in good hands, ryder214.

    Agreed. To explain, 'True' or "True" would be a textual comparison. The value of the control and/or the data type of the field it is bound to would have to be text and contain the word "True".

    True or Yes or On (no quotes) is a Boolean type and has the numeric value of -1 (or any other number except 0, depending on which way the conversion is happening - Boolean to numeric or vice versa). False/No/Off is always 0. Thus
    OR NFixer = True or
    OR NFixer = -1
    should result in the same evaluation.

    However, it is not recommended to utilize the numeric types in code in favor of the T/F values.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #23
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    Quote Originally Posted by pbaldy View Post
    Sent instructions on how to attach.
    It is still not letting me attach. Do you have skype or gotomeeting?

  9. #24
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    Quote Originally Posted by pbaldy View Post
    Sent instructions on how to attach.
    I have attached the file

  10. #25
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Steps to recreate issue?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #26
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    Quote Originally Posted by pbaldy View Post
    Steps to recreate issue?
    What do you mean by steps to recreate the issue?

  12. #27
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    What do you mean by steps to recreate the issue?
    I believe PBaldy means how does he find the relevant code in your database. What form should he be looking at?

    No DB was posted. Did you send it privately to PBaldy?

    Have you added any Debug.Print to see what your where clause resolves to or what the rowsource sql resolves to?

    What is "qSciName"? a table or a query?

  13. #28
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    It was not sent privately, it has apparently been deleted from the post that contained it. Perhaps that means the issue is resolved...

    Yes, I was after the steps required to cause the issue you're having. "Open form A, input 123 into textbox 1, click on button "blah".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #29
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    I thought you got the file, I will repost it. I apologize

  15. #30
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    pbaldy...thank you the file has been attached and emailed to you

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 03-17-2016, 05:53 PM
  2. Replies: 15
    Last Post: 11-01-2013, 03:24 PM
  3. macrohelp needed - error message if statement
    By dcorleto in forum Queries
    Replies: 8
    Last Post: 07-22-2013, 12:44 PM
  4. Replies: 2
    Last Post: 04-04-2013, 03:13 PM
  5. Replies: 7
    Last Post: 08-17-2011, 01:49 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