Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2007
    Posts
    8

    Unanswered: Multi Parameter Query

    I am trying to create a query that will extract either all data within the last 52weeks or all data older than the last 52 weeks based upon a prompt. I have written the following where statement but it keeps disappearing from my query field and I don't know how to write the statement to extract data older than 1 year.

    New Agent: [Date]>([yyyy],-1,Now())

    Can someone assist?

  2. #2
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    Not sure what the "([yyyy],-1,Now())" part of the expression does.

    C

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Data older than one year
    Code:
    WHERE your date field is less than (today's date minus 1 year)
    Code:
    WHERE   yourDateField < DateAdd("yyyy", -1, Now())
    George
    Home | Blog

  4. #4
    Join Date
    Sep 2007
    Posts
    8

    Multi Parameter Query Resolution



    Is there a way I can add a prompt to address an "or" statement between the two where statements?

    >DateAdd("yyyy",-1,Now()) or >DateAdd("yyyy",-1,Now())

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Write two queries then prompt the user throug VBA, calling a different query based on their choice.
    George
    Home | Blog

Posting Permissions

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