Results 1 to 5 of 5

Thread: Help ASAP...

  1. #1
    Join Date
    May 2004

    Unanswered: Help ASAP...

    Right, I need to use a query to show records between a set time period, for example, records over a year ago, but less than 2 years ago.
    thanks in advance

  2. #2
    Join Date
    Mar 2002
    SELECT * FROM MyTable WHERE MyDateField BETWEEN Now()-365*2 AND Now()-265

  3. #3
    Join Date
    Mar 2002
    that 265 should be a 365 instead..

    i.e. 1 year = 365 days

  4. #4
    Join Date
    Feb 2004
    Hi - simple one

    To look smart make a form - 2 unbound text boxes (well name them datefrom and todate)

    make a query looking at the record set you want to report from

    create a form or report to look at the result

    in the first form set a command button to open the result form

    in the query place some thing like

    Between [Forms]![Date search]![Fromdate] And [Forms]![Date search]![Todate]

    when you enter the dates to look between - click the openforn button and there you are

    hope this is ok for you


  5. #5
    Join Date
    Mar 2002
    Garethfx's technique will work (I frequently use this method myself for dynamically updating rowsources for drop/list boxes in forms with a line of code to refresh the data.).

    However, you did mention that you wanted a FIXED date range (assuming this really is an issue). If this is the case and you use that method you will then need to add code prevent the user from adding any range they want. Which is more work in the end. Also note that his method is for use in a FORM and if you plan to use this in a Query only you will get error messages as this type of query outside the context of a form will not know what the references to form fields are..

Posting Permissions

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