Consulting

Results 1 to 3 of 3

Thread: how to construct a filter

  1. #1
    VBAX Regular
    Joined
    Apr 2018
    Posts
    10
    Location

    how to construct a filter

    This finds all the records with e_mail containing the letter "w".
    Private Sub no_email_addr_Click()    Dim DocName As String
        DocName = "frmHomeOwner"
            DocFilter = "[e_mail] like '*w*'"
               Me.Filter = DocFilter
               Me.FilterOn = True
    
    
    End Sub
    but this won't find the email addresses that are null:

    Private Sub no_email_addr_Click()    Dim DocName As String
        DocName = "frmHomeOwner"
            DocFilter = "[e_mail] like ''" '  that is a double single quote followed by an ending double quote
               Me.Filter = DocFilter
               Me.FilterOn = True
    
    
    End Sub
    I get no results and no error messages.

    Thgouths on how I can get a list of records where there is no email address?

    Thanks,

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Am I correct in assuming [e_mail] is a field in an Access dataset and you are setting the form filter?
    If so you could try
    DocFilter = "[e_mail] is null"

  3. #3
    VBAX Regular
    Joined
    Apr 2018
    Posts
    10
    Location
    Quote Originally Posted by OBP View Post
    Am I correct in assuming [e_mail] is a field in an Access dataset and you are setting the form filter?
    If so you could try
    DocFilter = "[e_mail] is null"
    Your assumption is correct and your suggestion worked like a charm.

    I have tried "= null" but never "is"

    THANK YOU!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •