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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set "week ending" date 3

Status
Not open for further replies.

zs450

IS-IT--Management
Jul 17, 2002
36
US
I've got a report that I have to enter a "week ending" date on. Each week, right now, I manually go into the database and change that date to be the correspondig Friday.

What I would like to do is have the date, by default, be the upcoming Friday in the same format that I enter other dates: "8/21/2006"

Any help would be appreciated.

Thanks!
 
If you want the report to show the Friday of 'this' week, one way is:
Code:
DateAdd("d",6-Weekday(Date()),Date())
In this code Friday is the sixth(6) day of the week. If your system week does not start on Sunday, you will need to adjust this.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
zs450,

Here is a SkipVought trick for finding Monday: [tt]Int(([AnyDate] - 2) / 7) * 7 + 2[/tt], you could just add 4 to this [tt](Int(([AnyDate] - 2) / 7) * 7 + 2) + 4[/tt]

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Thanks to both of you. I'll try them out when I get to the office this morning!
 
Is there an easy modification to be able to locate the Equivalent Friday one year ago, example: This Friday is 25-Aug-2006, the Friday one year ago is 26-Aug-2005. When I used the regular date function I get literally one year ago (25-Aug-2005 rather than 26-Aug-2005).
 
Don't know how simple this is but
Code:
DateSerial(Year(MyDate)-1, Month(myDate), 
           Day(myDate)+IIF(Year(MyDate) Mod 4,1,2))
 
sxschech,
52 weeks a year, 7 days a week. [tt]#08/25/2006# - (52 * 7) = #08/26/2005#[/tt]

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top