Results 1 to 3 of 3

Thread: find records based on date

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    17

    Post

    Given two dates, start_date and end_date.
    How can I retrieve all records from the database, a create_date attribute is specified in the table, that are within the given date interval?


    e.g.
    start_date = "8/13/1999"
    end_date = "11/12/1999"

    records to retrieve should be in the range of the two given date.


    Thanks.

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    266

    Post

    Try this
    Select * from abcd where efgh >= DateValue(startdate) and efgh <= datevalue(enddate)

    efgh is the date field in the database

  3. #3
    Addicted Member
    Join Date
    Oct 1999
    Location
    Oporto, Portugal
    Posts
    134

    Post

    MSDNexpert was right but try it this way:

    stdate= DateValue(start_date)
    eddate= DateValue(end_date)

    "Select * from abcd where efgh >= #" & stdate & "# and efgh <= #" & eddate & "#"

    ------------------
    Jorge Ledo
    [email protected]
    Portugal

Posting Permissions

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



Click Here to Expand Forum to Full Width