Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weekly Reports

Status
Not open for further replies.

deesheeha

Programmer
Jul 28, 2006
38
IE
Hi, Im looking for some kind of code that will read a table and write out records from the table for the last week... i have it working on a daily basis but i also want it to read all sets from sunday and every sunday start fresh. any ideas would be greatly appreciated. not even code just a step in the right direction

Cheers
Dee
 
One possibility...
Create a WHERE clause that checks for the day of the week.
Code:
Dim intDay as Integer
Dim strWhere as String
intDay = Weekday(Now())
Select Case intDay
    Case = 1 [COLOR=green]'Monday[/color]
        strWhere = "WHERE [i]YourDateField[/i] BETWEEN Now() - 8 AND Now() - 1"
    Case = 2 [COLOR=green]'Tuesday[/color]
        strWhere = "WHERE [i]YourDateField[/i] BETWEEN Now() - 9 AND Now() - 2"
    etc
End Select
Note: This has not been tested.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top