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

Go to last record in a subform based on main form control 1

Status
Not open for further replies.

slobad23

IS-IT--Management
Jun 30, 2006
90
GB
I have a subform which shows records based on the autonumber ID field in the main form. At the moment it opens at the first record in the subform but it contains dates clients have been contacted and it makes sesne to have the last one showing first. The closes I have managed to come to this was getting it to go to the last record of the subform but it was not for a record relating to the main form's ID. It just went to the very last record in the table behind the subform and would not let me navigate away from it.

I have been hunting around for an answer to this all day!
The best I could find (and it looked by far the simplest solution) was this :
Unfortunately it didn't work. It just did nothing. I get a feeling that I could over come this with a simple solution that I just can't seem to find online.

Please help!

I am using access 2007 on a windows 7 machine (I don't know why it would matter too much but I always get asked things like that when on tek-tips so there you go) :)
 
Why not bind your subform to a properly sorted query ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How are ya slobad23 . . .

Is your subform linked to the main form thru [blue]Master/Child[/blue] link properties?

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Yes, the form and subform are linked.
The Subform has a master set as ID (from main) and child is ID (within itself).

I do not understand what PHV is trying to tell me. I have tinkered with adding a form based on a query but this doesn't seem to solve my problem.

 
If your subform is linked to your main form and that is working properly, then AceMan's code in your other post is the correct solution. Please show us how you implemented the code. Also in the event that implements the code, put a msgbox so that you can debug and verify that the event is firing. Something like
Msgbox "Code firing to move to last record".
 
PH's solution requires absolutely no code and is the simplest solution. Just set the subform's record source to a query or SQL statement like:
Code:
SELECT ... FROM tblYourTable ORDER BY SomeDateField DESC;
If slobad23 can't figure out the Record Source, please post at least the table name and field to sort on for the subform.

Duane
Hook'D on Access
MS Access MVP
 
I have bound the form to a query and it has worked.

Simple solutions always appreciated :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top