Query Question

D

DavidW

How do you phrase the expession in a query to retrieve the last group of
entries by date.
I am wanting to look in a table and get the last set of records entered by
date. If there is a month missing this would throw it of
Between DateSerial(Year(Date()),Month(Date())-1,Day(Date())) And
DateSerial(Year(Date()),Month(Date())-2,Day(Date()))
I need it to look at the date and find the last entered date and retrieve
all records with that date.
Thanks
David
 
R

Roger Carlson

On my website (see sig below) is a small sample database called
"MaxQueryProblem.mdb" which might give you a start.
 
K

Kevin

Not having yet mastered SQL, I create most of my queries
in the Query Builder, switch to the SQL view, then copy
and paste into the VBA window. That's cheating, but I do
not have the time to learn SQL well enough to do things
the hard way.

Hope that helps!

Kevin
 
T

Ted

You should be able to do this by using the DMax()
function as the criteria for the date field.

This would look something like this:

DMax("[DateFieldName]","TableName")

If you wanted to limit the domain that the function looks
at, you could add a third optional argument specifying a
WHERE statement (without the word WHERE), but it doesn't
sound like you need that.

Hope this helps.
 

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