Results 1 to 6 of 6

Thread: Find records Older than a certain date?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216

    Question Find records Older than a certain date?

    I need to pull up a recordset with records older than 30 days from today's date. How do I do that?

    here's my sql so far:

    Code:
            sql2 = "SELECT TOP 10 URL, SubDate, Submitted FROM Sites WHERE Sites.SubDate < '" & strDat + 30 & "' AND  Sites.Submitted = '" & strNoSubmit & "' ORDER BY Category"
    thanks

  2. #2
    Lively Member xhomerx's Avatar
    Join Date
    Feb 2001
    Posts
    98
    dont put an apostrophe around the date - if u r using an access database put # before and after the date.....

  3. #3
    nullus
    Guest
    Also, are you trying to add 30 days to the date here:

    Code:
    WHERE Sites.SubDate < '" & strDat + 30 & "'
    If so, I doubt that'll work. Use the DateAdd function:

    Code:
    DateAdd("d", 30, Date)

  4. #4
    nullus
    Guest
    I stand corrected, it does work But I prefer the DateAdd function anyway.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    well for me it didn't work. I'm not sure if the date + 30 really means to VB 30 days backwards from today. Do you?

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216

    Talking

    nullus

    the DateAdd function works better. You are right!

    thanks

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