Last Record in Data Sheet

olerebel

New member
Local time
Today, 08:14
Joined
Jul 16, 2006
Messages
9
In my database I have all my clients information in the [Main] form and all their transactions / debits / etc. in a subform [Transactions] in datasheet view. My question is how can I have the subform automatically scroll down to the last record (or to a new record) so the user doesn't have to scroll down everytime a new client is viewed?

-Alex :o
 
If the SubForm query has an AutoNumber then sort on it Descending and no scrolling required.

Edit: The other option is to set the focus to a control on the SubForm (a two step process) and then go to the last record. e.g.
Code:
[COLOR="Green"]Me.SubFormControlName.SetFocus                      '-- Set Focus to the SubFormControl 1st
Me.SubFormControlName.Form!txtControlName.SetFocus '-- Set Focus to the Control on Subform
DoCmd.RunCommand acCmdRecordsGoToLast           '-- And move to the new record[/COLOR]
 
Last edited:
Perfect

Thank you, that is exactly what I was looking for! Now, how would I execute an event procedure from a 'find' button? I have it working with the 'On Load', Next and Previous buttons.
 
Last edited:
Have you tried putting the code I supplied in the Current Event of your form?
 
Yes

It works great :) Now on similar lines (not directly related) when I switch my focus else where, how can I store the previous focus so I can return back to it? :confused:
 
Before moving the focus save the Screen.ActiveControl or maybe the Screen.PreviousControl and then set the focus bak to it when you are done.
 

Users who are viewing this thread

Back
Top Bottom