Results 1 to 3 of 3

Thread: Display records based on date comparison

  1. #1
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Display records based on date comparison

    I've created a form - the contents of which are written to my Access database table. Fine.

    However, I want to display only those records where the submission date was within, say, the last 10 days. The date of submission (sub_date) is captured within the table - so this value is available to be compared against for each record.

    Can someone please show me how I can compare this value against the current date - checking if it falls within the '10 day' window and then displaying only those records..?

    I think I can somehow achieve this with the 'DateDiff' function...but I haven't found an example to explain how?

    Thanks in advance,

    N.

  2. #2
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thinking on.... I've got this far.... It's just not quite right...

    Can anyone help please?


    recent = DateAdd("d",-10,date())

    MySQL="Select * FROM " & strTable & " where Sub_Date >= " & recent & ""

    Set MyRs=MyConn.Execute(MySQL)

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Don't think anyone speaks ASP here
    Maybe the well-named Otaku... but he's hardly ever here.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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