Display ONLY most recent record

Kila

Registered User.
Local time
Today, 15:40
Joined
Mar 5, 2003
Messages
275
My form has a button that opens a report. This report is based on a query that sets the report to display ONLY information related to the person in the current query record.

How can I get the report/query to display ONLY the last (most recent) record in the query?
 
Kila,

Your report should be fed by a query.

The query has criteria for the person field =Forms![YourMainForm]![YourPersonField]

It can also use the TOP predicate:

Select Top 1 [Person] ...

Wayne
 
Thanks for your response

Thanks for your response. There IS a query behind the report, and it only displays the active person on the form:
The "SSN" field in the query =[Forms]![ADMINfrmDemographicDataEntry]![SSN].
An additional piece of information...the Form that has the person selected also has two subforms on it.

Subform number 1 has the student/resident's annual rotation (linked by SSN)...4th year med student, 1st year resident, etc.

Subform number 2 has the rotation for the month (also linked by SSN)...Cardiology, Pulmonary, etc.

Right now, when I click the button to generate the form, it generates a form (page in the report) for every monthly rotation, so if I print the entire report, it might print 52 pages. Most of the time, the last form SHOULD be the one I want...since the most recent annual AND monthly rotation are the applicable ones. Just to get that to work would be OK.

However, what I am REALLY trying to do is ONLY print the form for the most recent monthly rotation that has the information for the annual rotation for which the dates match. For example, the resident's annual rotation is 10/1/05 - 9/30/06, and the monthly rotation is 6/06, which is within this time frame. It becomes an occasional problem when a resident is rotating on an off schedule like the one above. I may go ahead and enter the NEXT annual rotation (10/1/06 - 9/30/07) so that I won't forget to do it, but the MONTHLY rotation applies to a previous record.

I am sure all of this is as clear as mud. Do you have any suggestions?
 

Users who are viewing this thread

Back
Top Bottom