running date query show

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access Training and help » Running a date query to show records from the previous month

Running a date query to show records from the previous month

resolvedResolved · Medium Priority · Version 2007

Jamie has attended:
Access Introduction course
Access Intermediate course

Running a date query to show records from the previous month

I have a table which I add records to daily, one of the fields is a date field.
I want to run a query that returns all the records from the previous month. According to the Access help I should be using this criteria:
Year(Date())*12+DatePart("m",Date())-1
However, it's not returning any results.
Please help!
Cheers,
Jamie

RE: Running a date query to show records from the previous month

Hi Jamie, thanks for your query. Difficult to advise on this one without seeing the criteria in context with the query and your data. However, why not try a parameter query?

Try this criteria on the date field

"Between [Enter Start Date] And [Enter End Date]"

...which should prompt the user to enter the dates, and pull out the relevant information or alternatively, or if you want it to happen automatically:

Between Date( ) And DateAdd("M", -1, Date( ))

Hope this helps,

Anthony

Fri 18 Feb 2011: Automatically marked as resolved.

 

Training courses

 

Training information:

See also:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Random sampling

Data is th key to a good database, therefore checking is essential.

A good way of checking data is by random sampling. You can do this in a query, by typing the follow:
1) In the Field box create a RandonID field eg. Randon Id: Rnd(fieldname])

2) sort the field
3)Right click and chage the properties for To value to be the number of randon records you want to see.

4) Change the set to Show row for Randon ID to be False, add all the other fields you want to see and the run the query.

View all Access hints and tips


Server loaded in 0.09 secs.