Last record in subform

jzacharias

Registered User.
Local time
Today, 13:06
Joined
Sep 13, 2010
Messages
137
I am trying to open up a subform to the last record. I used a macro to goto the last record on load, which works fine for the first record, but any record after the initial load is not showing the last record. How do I show the last record when scrolling through the main form record selectors.
 
How are you defining last record? Do you have a date/time stamp to identify which is the last (if defining last entered)?
 
I could use last date
 
So, make the form's record source a QUERY which has it sorted by Date and then you should be able to set the subform to the last subform record by using the Main form's Load event -
Code:
Me.SubformControlName.Form.Recordset.MoveLast

That is where SubformControlName is the name of the control on the main form which houses the subform. It is not the name of the subform (unless the subform and subform control have the same exact name).
 
Or use Order By in the form properties.

From the Access help file.
Code:
When you set the [B]OrderBy[/B] property by entering one or more field names,
the records are sorted in ascending order. Similarly, Visual Basic sorts
these fields in ascending order by default.
 
If you want to sort records in descending order, type DESC at the end of
the string expression. For example, to sort customer records in descending
order by contact name, set the [B]OrderBy[/B] property to "ContactName
DESC".
 

Users who are viewing this thread

Back
Top Bottom