Results 1 to 3 of 3
  1. #1
    mick3911 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2013
    Location
    Wirral, UK
    Posts
    66

    IIF query statement with two dates

    I am trying to create a field in a select query called ‘Status’ which will be populated depending on two date fields.



    The dates fields are ‘ClosedDate’ and ‘VerifiedDate’.

    The statement I am trying to get is;

    If ClosedDate and VerifiedDate are blank, then return ‘Open’.

    If ClosedDate contains a date and VerifiedDate is blank, then return ‘Closed’.

    If both ClosedDate and VerifiedDate contain dates, then return ‘Verified’.

    I have tried the following but keep getting an invalid syntax message.

    Status: IIf(IsNull([ClosedDate] AND [VerifiedDate] , "Open"),IIf [ClosedDate]<=Date() AND (IsNull([VerifiedDate], "Closed", "Verified")

    Can someone please point me in the right direction to solve this?

    Many thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Status: IIf(Not IsNull([VerifiedDate]), "Verified", IIf(Not IsNull([ClosedDate]), "Closed", "Open"))
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mick3911 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2013
    Location
    Wirral, UK
    Posts
    66
    Hi June7,

    That works great. Simple really when you read it.

    I didn't know about 'Not IsNull'

    Thank you for your help.

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

Similar Threads

  1. Replies: 2
    Last Post: 09-19-2017, 11:31 AM
  2. Replies: 9
    Last Post: 08-31-2016, 04:11 PM
  3. Replies: 11
    Last Post: 04-29-2015, 01:38 PM
  4. Replies: 4
    Last Post: 04-23-2012, 05:07 PM
  5. Query input dates for range of dates in two fields
    By kagoodwin13 in forum Queries
    Replies: 3
    Last Post: 02-13-2012, 04:25 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