Solved

How Can My Query Return Only Items With a Date from "Last Week"?

Posted on 2011-09-28
4
260 Views
Last Modified: 2012-05-12
To make it easier, it already assigns a "week ending" date, so every record has a Saturday date. I just want to have the returns limited to the items with the date from "last Saturday"

I will run this query any day from monday to Friday of "This Week", but I always want it to ONLY show the results from last week.

Does that make sense? thanks.
0
Comment
Question by:Rex85
  • 2
  • 2
4 Comments
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 36719524
Where [Week Ending] = date() - weekday(Date(), vbSaturday)
0
 

Author Comment

by:Rex85
ID: 36719569
Fyed:

My WHERE clause looks like this...

WHERE ((CAR_Requests.Status)="Closed") And Where([Closed Date]=date()-weekday(Date(),vbSaturday))

I got an "Undefined Function in WHERE Clause" Error when trying to execute it. Did I do something wrong?

Thanks
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 36719582
Try:

WHERE CAR_Requests.Status="Closed"
And [Closed Date]=date()-weekday(Date(),7))

If this is in a query, you will probably have to replace vbSaturday with the numeric value of 7
0
 

Author Closing Comment

by:Rex85
ID: 36719623
That worked! Thank you.

Rex
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS Access 2016 Debugging 7 42
Storing Combo Box Selection in Table 12 41
Two list boxes - best structure 3 31
Operation must use an updatable query 4 23
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now