Need Date Code for week beginning Thursday and ending Wednesday

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

I have a form that I need to show the payroll week (Date Criteria) for. The
week starts on Thursday and ends on Wednesday.
I want to use a query and set the date range so that the form opens with the
records between this date range.
Code below is used on a similar form, but want to use it for new form. New
forms name is FX_driversClock.
The AnyDate default is Date(). These text boxes are on another form.
I could use a popup form to do this but wanted to use query instead of
having to use another form.

Thanks, Dave


=CDate([AnyDate])-(Weekday(CDate([AnyDate])))-2
=CDate([AnyDate])-(Weekday(CDate([AnyDate])))+4
 
Why not use the formulas as filter criteria in your query? It'll looks
something like:

WHERE [Payrolldate] BETWEEN CDate(Date())-(Weekday(CDate(Date())))-2
AND CDate(Date())-(Weekday(CDate(Date())))+4

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 
Back
Top