Results 1 to 4 of 4
  1. #1
    PeterS is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2018
    Posts
    45

    Null

    Hi



    My query works 100% until I try to execute a "Is Not Null" criteria

    This is what it looks like:

    SAF_Asset ForkliftNumber ServiceDate OperationHours Record
    Yes 53 2018/11/05 2382
    Yes 53 2019/01/10 24539
    Yes 53 2019/01/21 2461,5 2019/01/21
    Yes 53 2019/02/11 2500,1
    Yes 53 2019/02/18 2512,5
    Yes 54 2017/02/15 6956,4
    Yes 54 2017/03/17 6656

    What I want to do is filter out all the blank record in the "Record" field (which is based in an IIF statement).
    When I apply the Is Not Null criteria in the "Record" field then there no change.

    Is this because the "Record" field is an IIf clause?
    Record: IIf([ServiceDate] Between Date()-"30" And Date()-"40",[ServiceDate],"")

    Please help

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    you are using strings "30" , dates are numeric, Date()-30
    or
    between DateAdd("d",-30,Date) and DateAdd("d",-40,Date)

    but I wouldn't use the IIF, instead make another field in the query that pulls dates in that range, then apply your criteria inside that field.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I'll point out that you formula doesn't put Null there, it puts a zero length string. You'd need to test for whatever value you have there:

    http://www.baldyweb.com/NullEmptyEtc.htm

    so more like

    <>""

    or return Null instead of "".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    PeterS is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2018
    Posts
    45
    Thank you guys

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

Similar Threads

  1. Replies: 4
    Last Post: 03-11-2017, 09:48 PM
  2. Replies: 7
    Last Post: 11-07-2016, 09:24 AM
  3. If/Then Null based on Null Value of Another Field
    By vbpeterson in forum Queries
    Replies: 11
    Last Post: 06-05-2012, 05:00 PM
  4. Replies: 1
    Last Post: 02-23-2012, 02:27 PM
  5. Finding the Max Date and Null Values if Null
    By SpdRacerX in forum Queries
    Replies: 1
    Last Post: 02-03-2012, 06:29 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