Results 1 to 6 of 6
  1. #1
    MikeNZ is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2016
    Posts
    7

    Like criteria in query field

    Just starting to teach myself Access so am very new to terminology and how things work, so please bear with me.



    I have a table that records the number of days someone has off and want to create a query which will give me the number of days or greater specified in a form field. The form has other fields that can be used for a search which I have used Like criteria but when I try to use Like for the this particular field it won't give me a result I need. Below is the criteria I have used:

    like"*"& (>=Forms![frmSearch]![#OfDays])&"*"

    Could someone please explain what I have done wrong and how to fix it?

    Thanks for any and all help.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you cant use LIKE and >
    do 1 or the other.

  3. #3
    MikeNZ is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2016
    Posts
    7
    I see, thanks for the reply. I used Like because I want to be able to have the field empty and perform a search with the other field criteria.

    In that case, is there a way that I can have the query show the results I'm after?

  4. #4
    MikeNZ is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2016
    Posts
    7
    I have created separate queries to give the results I need

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    you could try

    = Forms![frmSearch]![#OfDays] OR nz(Forms![frmSearch]![#OfDays],0) =0

    although using # in field names is a really really bad idea

  6. #6
    MikeNZ is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2016
    Posts
    7
    Thanks for the suggestion and the advice. I will give it a go and will change the field name to "NumberOfDays"

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

Similar Threads

  1. Query Criteria Multivalue field
    By JonathanT in forum Queries
    Replies: 2
    Last Post: 06-21-2016, 03:16 PM
  2. Replies: 2
    Last Post: 09-11-2015, 12:42 PM
  3. Replies: 7
    Last Post: 06-03-2015, 11:42 AM
  4. Replies: 3
    Last Post: 07-09-2014, 06:39 AM
  5. Different criteria for same field in same query
    By teirrah1995 in forum Queries
    Replies: 10
    Last Post: 08-12-2011, 01:03 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