Help with Form Expression for Default Date Value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I am trying to create a Form Expression that will default to the record
with the most recent, past weekending date. So the referenced table
currently has records of weekending dates like 3/7/04, 3/14/05, 3/21/05. And
if today is 3/21/05, the form should default to weekending date of 3/19/05.
Thank you!
Ned
 
Do your weeks end on Mondays? The dates you list as weekending dates are
Mondays, then you say you want a weekending date of Saturday. I don't follow
exactly what you are wanting.
 
Hi Wayne,

Apologies. I mistyped the weekend dates. The weeks end on Saturday, e.g.
3/5/05, 3/12/05, 3/19/05.

So, if someone went to the Access Form from 3/20/05 to 3/26/05, I want the
default value presented to be weekending 3/19/05--i.e. the most recent
completed week.

Thanks for your time and advice.
 
To get the date of the preceding Saturday:

=Date() - WeekDay(Date())

This will give you the 12th if today is the 19th. If you want to keep the
current Saturday if today is Saturday then:

=IIf(WeekDay(Date()) = 7, Date(), Date() - WeekDay(Date()))
 
Thanks a bunch Wayne!

Ned

Wayne Morgan said:
To get the date of the preceding Saturday:

=Date() - WeekDay(Date())

This will give you the 12th if today is the 19th. If you want to keep the
current Saturday if today is Saturday then:

=IIf(WeekDay(Date()) = 7, Date(), Date() - WeekDay(Date()))
 
Back
Top