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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coding for Textbox to retrieve maxdate 1

Status
Not open for further replies.

jminn0311

Technical User
Jan 7, 2004
66
US
Can anyone help me with some coding for a textbox in the header of my report that would return the maxdate of the records from the query on which the report is generated? Sorry about the run on sentence! Thank you.
 
Thanks for the reply. Your advise is appreciated! I used something a little different to format it.
=Format(DMax("DateOfIncident","qryIncidentInvestigationReport"),"yyyy")
 
DMax() creates another recordset which is not efficient. I wasn't aware you were looking for only the year. I typically open reports with a where condition. The DMax() expression may return the wrong results.

If you want the year only and don't want the inefficiency of another query against your database and want a guaranteed accurate result, use:
Code:
=Year(Max([DateOfIncident]))

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top