query with dates

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

Guest

I have to run a query depending on certain dates....Every wednesday, i have
to check for the last pay period which is monday before last to last sunday.
So, for today the start date would be 10/11/04 and the end date would be
10/17/04. Both have to fall in the same month as today. Else, both are
null. So, in the month of october, the start and end dates I end up with are
.....

Start date End date
10/4 10/10
10/11 10/17
10/18 10/24 only

Any ideas on how I would translate this into a calculation I could perform
in access?

Thanks much
 
First of all, I would not recommend changing dates in a query. Instead,
create a form with two unbound date fields (BegDate, EndDate). In your
criteria line of your query, use the expression builder to point to those
fields. For example, your criteria might look like
Between Forms![frmInputForm]![BegDate] and Forms![frmInputForm]![EndDate]

Then, you can make the values of those dates on your form be based off a
calculation or manual input.

Like BegDate default value could be
=Date() - WeekDay(Date())+2
which would be Monday of the current week

You would be able to overwrite the date with a manual date also.
Look at "Functions for Calculating and Displaying Date/Time Value" in
Microsoft knowledgebase for more examples of date formulas.

Hope this helps. Jackie :o)
 

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

Back
Top