Results 1 to 3 of 3
  1. #1
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150

    Filtered Query

    I have a MyForm1 that's record source is based on a query that has few TempVars variables that are fed from MyForm2. Some of the variables will be null. Therefore, the query's criteria are
    Code:
    Like "*" & [TempVars].[Variable1] & "*"
    , so the query still returns records when Variable1 is null while other variables may not be. My issue is that if Variable1 value is "roofing", the query returns "Roofing" and "Waterproofing". How can I set the criteria so that it only returns "Roofing"?

  2. #2
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    That will also make the query very inefficient. Try it this way assuming you don't need any wild-carding normally;

    = [TempVars].[Variable1] OR [TempVars].[Variable1] is Null
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150
    Quote Originally Posted by Minty View Post
    That will also make the query very inefficient. Try it this way assuming you don't need any wild-carding normally;

    = [TempVars].[Variable1] OR [TempVars].[Variable1] is Null
    That seems to do the trick on this query. I have used this format before, but I don't think it always work. That's why I've used the wild card version. Meantime, I'll convert it to your suggestion and will come back if I have issues. Thanks for your help.

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

Similar Threads

  1. form filtered query
    By Newby in forum Access
    Replies: 3
    Last Post: 02-05-2018, 03:24 PM
  2. Filtered Records Wont Stay Filtered
    By ortizimo in forum Access
    Replies: 4
    Last Post: 11-29-2017, 07:08 PM
  3. Filtered Report from filtered datasheet form
    By gemadan96 in forum Reports
    Replies: 7
    Last Post: 01-03-2014, 05:12 PM
  4. Filtered query look up
    By FuzzyLogician in forum Access
    Replies: 2
    Last Post: 02-09-2012, 11:00 AM
  5. Filtered Print Query
    By Lupus in forum Queries
    Replies: 0
    Last Post: 08-17-2007, 02:50 AM

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