Results 1 to 4 of 4

Thread: Date Problem

  1. #1
    Join Date
    Oct 2002
    Posts
    9

    Unanswered: Date Problem

    Hi,

    I have been looking for a way to get a date range I need.

    IIF([Period]Between DLookup("[DateFrom]","Period") And DLookup ("[DateTo]","Period"),[Advance],0)

    This currently returns data on the following period "01/01/2004" to "01/05/2004"

    This part works fine.

    In the same query I need to create a new column and retrieve data for the same period 12 months earlier.

    Is there a way to use the above code and tell it to use 2003 instead of 2004.
    ie:

    "01/01/2003" to "01/05/2003"

    Thanks in advance.

    Darrell......

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    i'm slightly surprised that you are happy with your dlookup()... without criteria, dlookup returns a more-or-less random entry from the domain.

    anyway - assuming dlookup() returns something you are happy with, then
    dateadd("yyyy", -1, dlookup())
    will take it back a year.

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Oct 2002
    Posts
    9
    Hi,

    Thanks for the reply, how would I use the following code in my DLookup shown above??

    dateadd("yyyy", -1, dlookup())

    Thanks in advance

    Darrell....

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    if dlookup(blah blah) returns a date that makes you happy and now you want a new expression that does the same but one year earlier, put:
    dateadd("yyyy", -1, dlookup(blah blah))

    izy
    currently using SS 2008R2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •