Playing with dates

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

Guest

Hello All,

In general how are week ending dates handled? Is there a way to put in any
given date and have the Saturday of that week and corresponding week number
within that year populate a given field?

Thanks

Joe
 
Generally, you don't want to store calculated data in the table. However,
you can create a calculated control on a form or report or a calculated
field in a query to do what you're wanting.

The Saturday of the week for any given day could be calculated with this
example Control Source:

=[DateTextbox] - Weekday([DateTextbox]) + 7

To get the week number of the date, you could use this as the Control
Source:

=Format([DateTextbox], "ww")

When you enter a date in the textbox or when you move to another record that
already has a date, the calculated controls will update themselves
automatically if they are on the same form or report as the textbox with the
date.

To do this as a calculated field in a query, you would use something like:

NextSaturday:[DateField] - Weekday([DateField]) + 7

This would create a field in the query called NextSaturday and would display
the date of the Saturday after the date in the DateField (please don't use
"Date" as the name of your date field, "Date" is a reserved word).

For the week of the year field, you would use something like:

WeekOfYear:Format([DateField], "ww")
 
Back
Top