View Full Version : Date Calculation


buffbarflynj
06-05-2008, 10:37 AM
Trying to generate a date based on existing Date data.

If date in the query is 06/05/08 and associated Week Ending Date would be 06/07/08 (Saturday), what is the criteria used to make this happen for all dates? (i.e if another date is 06/10/08 then the WE date would be 06/14/08-always the Saturday of each week)

KenHigg
06-05-2008, 10:47 AM
Something like the following should work:

[MyDate]+7-DatePart("w",[MyDate])

???

buffbarflynj
06-05-2008, 10:54 AM
[MyDate]+7-DatePart("w",[MyDate])

When pasted into criteria is acting as a parameter and asking me to key in MyDate

Should I not have been so literal as to copy past the formula in? One additional piece of info is that there will be thousands of records, each with different dates.

Thanks much for the help!

KenHigg
06-05-2008, 10:59 AM
I'm not sure what it is your wnating to do in the end but you can put it in the query build as a new field, replacing the 'MyDate' with the name of your date field and giving it a meaninfull name. Something like:

Reporting Date: [MyDate]+7-DatePart("w",[MyDate])

buffbarflynj
06-05-2008, 11:03 AM
Ken!!! U R Amazing! Worked like a charm! Thanx much!!!!
Troy

KenHigg
06-05-2008, 11:04 AM
Cool - Glad to help. :)