How to display and store current Week Ending Date (Saturday's)

  • Thread starter Thread starter ianw
  • Start date Start date
I

ianw

I need help in VBA to work out and store week ending dates (Saturday’s) for a
new Time Sheet application.
I would like Saturday’s week ending date to appear on each days use of the
Time Sheet form, that would increment each week.
If the time Sheet form is opened on a Saturday, the week ending date needs
to show as being the same day.
It would also be useful to have the latest week ending date stored as a
singular record in a new table for use in reporting other data using the
latest week ending date.
 
Hi

If you have 2 boxes on your form
MyDateBox (where you enter a date)
MySaturdayBox (where you want the next saturday shown - or today if it's Sat
today)

You could have some like this on the AfterUpdate event of your MyDateBox

Private Sub MyDateBox_AfterUpdate()
Me.MySaturdayBox = DateAdd("d", vbSaturday - Weekday(Me.MyDateBox,
vbSunday), Me.MyDateBox)
End Sub

Hope this helps
 
Hi

If you have 2 boxes on your form
MyDateBox (where you enter a date)
MySaturdayBox (where you want the next saturday shown - or today if it's Sat
today)

You could have some like this on the AfterUpdate event of your MyDateBox

Private Sub MyDateBox_AfterUpdate()
Me.MySaturdayBox = DateAdd("d", vbSaturday - Weekday(Me.MyDateBox,
vbSunday), Me.MyDateBox)
End Sub

Hope this helps
 
Back
Top