Need Date Code for week beginning Thursday and ending Wednesday

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
 
J

John Viescas

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top