One for the dates guys

guinness

Registered User.
Local time
Today, 06:09
Joined
Mar 15, 2011
Messages
249
Hi Folks

I'm trying to set an 'on load' event for my form so that it sets the date field [W/C Date] automatically to last Mondays date.

Originally I had it set to open for Monday of the present week using:
Me.[W/C Date] = Date - Weekday(Date) + 2

But the user wants it to open displaying the previous week as they use the report retrospectively.

Any help much appreciated.
 
Astonishingly that worked. Thanks

I'd be even more grateful if you could explain even briefly why that worked. I had already tried -7, -2 and +1 but to be honest was struggling to understand the results I was getting. Not very good with Access.

Thanks again
 
Weekday returns a number 1 - 7 (Sunday - Saturday by default) which corresponds to the current day of the week. If you take Date - Weekday(Date), you'll get the Saturday of the previous week. Adding 2 makes it Monday of the current week. Subtracting 5 takes it to the Monday of the previous week
 
Thanks for that

That really helps and might even prevent me from asking more silly questions.

Thanks again

Kev
 

Users who are viewing this thread

Back
Top Bottom