create a query that will pull data from last week information only

D

Dmackcwby

I have a d/b that keeps track of my customer service reps performance service
levels. I update the data on a daily basis. I normally report the
information out on a monthly and YTD document. I have recently been
requested to report the prior week info.

I can get the queries to report the weekly info, but how do limit the
information only the prior week?
 
J

John Vinson

I can get the queries to report the weekly info, but how do limit the
information only the prior week?

Use a criterion of

BETWEEN DateAdd("d", -7, Date()) AND Date()

on the date field to get the "prior week" meaning the past seven days
(Tuesday last week through Tuesday this); or

BETWEEN DateAdd("d", -6-Weekday(Date()), Date()) AND DateAdd("d",
1-Weekday(Date()), Date())

to get the past calendar week, Sunday through Sunday.

John W. Vinson[MVP]
 
T

tperica

hi to all
this is what I was looking for in past few days. How to paste this code,
into my Q. I have one table with "start date" and "end date" fields.

SELECT ..... WHERE BETWEEN DateAdd("d", -6-Weekday(Date()), Date()) AND
DateAdd("d",> 1-Weekday(Date()), Date())

what to change for my case ?

cheers
tomislav
 
J

John Spencer

You need to specify the field to which you are applying the criteria.

SELECT ..... WHERE [SomeTableName].[SomeFieldName] BETWEEN
DateAdd("d", -6-Weekday(Date()), Date()) AND
DateAdd("d",> 1-Weekday(Date()), Date())

If you are using the query grid the
Field: SomeFieldName
Table: SomeTableName
Criteria: BETWEEN DateAdd("d", -6-Weekday(Date()), Date()) AND DateAdd("d",>
1-Weekday(Date()), Date())
 

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