Results 1 to 6 of 6
  1. #1
    trident is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    141

    Using query and expression that is greater than 0

    May I request for assistance please.



    I have a query with the following columns:

    Submit Date - Medium Date
    DeadLine Date - Medium Date
    Revise Deadline Date - Medium Date

    I have created 3 expressions:

    EXPR1 - IIf(IsNull([revisedeadlinedate]),[deadlinedate],[revisedeadlinedate])
    EXPR2 - Date()
    EXPR3 - IIf(IsNull([Submit]),[expr1]-[expr2],0)

    I am trying to use expression 3 to get all values that is greater 0, by putting >0 in the criteria, however, when the program runs, it is asking a value for expression 1 and 2.
    If you press enter, it will show a blank list, but if you put values in EXPR 1 and 2, it shows an error message.

    Hope to hear from you guys.

    Thanks.

    Trident

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if this is an aggregate query you can't reference a calculated field like that you'd have to do something like:

    IIf(IsNull([Submit]),(IIf(IsNull([revisedeadlinedate]),[deadlinedate],[revisedeadlinedate]))-(Date()),0)

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    your exact syntax for those expression fields must be with a colon i.e.:
    EXPR1:IIf(IsNull([revisedeadlinedate]),[deadlinedate],[revisedeadlinedate])
    EXPR2ate()
    EXPR3:IIf(IsNull([Submit]),[expr1]-[expr2],0)

    your post says you are trying to use a >0 but I don't see where that is suppose to be going.....

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I think he means he's putting > 0 in the criteria of the EXPR3 field

    putting criteria in calculation fields in aggregate queries just doesn't work if the formula uses any alias calculations within the query itself.

  5. #5
    trident is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    141
    The use of >0 in EXPR3 is that I will be able to get the records that are greater than 0, right now, i have a lot of record and that only few of these are greater than 0.

    Any way to get this query running.

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I answered in post #2 did you try it

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

Similar Threads

  1. Replies: 11
    Last Post: 04-11-2014, 04:26 PM
  2. Replies: 1
    Last Post: 04-10-2014, 12:55 PM
  3. Replies: 5
    Last Post: 01-09-2014, 03:06 PM
  4. Replies: 3
    Last Post: 04-09-2013, 09:32 PM
  5. Greater than query
    By noobaccess in forum Access
    Replies: 5
    Last Post: 12-05-2012, 09:18 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