Solved

access date query criteria

Posted on 2011-02-28
4
387 Views
Last Modified: 2012-05-11
Mental block over query criteria:

I have a sales date field [date of sale] and I want separate criteria for two separate queries.

The first query is " which clients have placed a sale in the last 30 days" by reference to clients records

The other is message box "those clients which sales since have taken place since [insert date]"

Each client has its own record. the two queries are stand alone.

Just need the criteria for the date field query.

0
Comment
Question by:topUKlawyer
  • 2
  • 2
4 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 35004645
The first query needs to be a groupby/totals query.  Just needs Customer name  and Date of sale fields.
Group By customer name and get Max of date of sale.
Set the criteria on the Date of sale column to
>Date()-31

Secod query is the same as the first except the criteria is :
>[Enter date]
You should declare [Enter Date] in the query parameters as a datetime datatype to prevent invalid dates being entered.
0
 

Author Comment

by:topUKlawyer
ID: 35004792
Thanks.

Not sure where this is declared/entered:

You should declare [Enter Date] in the query parameters as a datetime datatype to prevent invalid dates being entered.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 35004986
In query design view choose Query>Parameters from the menu.
0
 

Author Comment

by:topUKlawyer
ID: 35010853
many thanks. esp the parameters point which i had not come across before.

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

13 Experts available now in Live!

Get 1:1 Help Now