Generating All Posts From Previous week, current w

Results 1 to 2 of 2

Thread: Generating All Posts From Previous week, current w

  1. #1
    Join Date
    Dec 1969

    Default Generating All Posts From Previous week, current w

    I&#039;m using ASP with Access 2000.<BR><BR>I&#039;m creating an announcement systems that lets users posts announcements to be later verified by the admin. Once the admin verifies them, they are moved into a table called Verified.<BR><BR>Now then, on the main page, it should display all posts for the current week. The values of the current week (startdate and enddate) are stored in a table called CurrentWeek. <BR><BR>The main page pulls out the two values from CurrentWeek, then uses this SQL statement to select all posts within the week (thanks for someone earlier on the board for providing me with this SQL).<BR><BR>strSQL = "SELECT * FROM Verified WHERE DisplayStartDate BETWEEN #" & dateCurrentWeekStartDate & "# AND #" & dateCurrentWeekEndDate & "#" <BR><BR>it then displays them. but the question is, how do i do this for the previous week and the next week? I thought about for previous week just subtracting seven from the current dateCurrentWeekStartDate and selecting from the range (dateCurrentWeekStartDate - 7) to dateCurrentWeekStartDate . And for the next week, just adding seven to the dateCurrentWeekEndDate. And then doing dateCurrentWeekEndDate to (dateCurrentWeekEndDate + 7).<BR><BR>But i&#039;m not real familiar with dates and adding and subtracting them and all that. Plus, I&#039;m not even sure if this is the best solution. If someone could tell me either how to implement the solution I thought of or suggest a better one I would be much grateful.

  2. #2
    Join Date
    Dec 1969

    Default RE: Generating All Posts From Previous week, curre

    You&#039;re on the right track. You can use the DateDiff function.<BR><BR>Check the VBScript reference (on the left) for details.

Posting Permissions

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