Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Latest Date (2)

Status
Not open for further replies.

sanders720

Programmer
Aug 2, 2001
421
US
I would like at access a table and get the data with the latest date in the table. That date could be any date or time, so I am unable to write code for specifics. I would appreciate a VB6 code example to utilize the max function, since this function is avalable in Access and not in VB6. Also, whats the difference between max and dmax?

 
Sanders,

This is one way you could use the max function to read the latest date from a group of records queried by your particular criteria.
Code:
SELECT Max([Date]) AS [MaxDate] FROM YourTable WHERE [SomeOtherField] = YourCriteria;

You could also include the date field in your query, sort by the date field DESC and take the TOP 1 value.

MAX, TOP, and SELECT topics in Help will make it all pretty clear.


HTH John

Use what you have,
Learn what you can,
Create what you need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top