Open a subform and display the last bottom record

rickyfong

Registered User.
Local time
Yesterday, 19:33
Joined
Nov 25, 2010
Messages
199
I got a form / subform relationship. Just want to know how to locate the bottom record, when the user after some queries input at the main form. I desire to display the bottom end record (EOF), instead of some sorting and display the last record at top of the subform!! Thanks a lot!!
 
Look at GoToRecord and see if it does what you want.
 
I got the following from another thread, but I simply don't know how to call the command from main form!! It always telling me "=" is missin! Any idea ?? THanks!!

In your subform add a public sub like so:


Code:
Public Sub GoToLastRecord() 'Go to the last record in the subform. DoCmd.GoToRecord , , acLastEnd Sub
And then in your main form call it like so:


Code:
'Go to the newly added record.Forms!frmMyForm!subfrmMySubForm.Form.GoToLastRecord
And your subform will navigate to, in this case, the last record.
 
I'm not familiar with that technique, so perhaps following up on the thread where you found it would be appropriate?
 
SOrry! The thread just given the above advise!! I simply don't know how to make a call from the main form!! Thanks a lot!!
 
I would like to have the subform displayed as a Excel sheet like format, and the display is pointed at the last bottom record! For instance

A BOY
B GIRL
C BABY

The ACCESS pointer is pointed at the Last record which is "C BABY". So that user can immendiately input a new record at the end if they desiired. Thanks a lot!!
 
What field can you use to indicate the first and last records?
 
For the present moment, I don't have a unique field to do so. Is that, I need such a field?? Cause right now, I only insert record to that file with custname, material code and unit price only!! Thanks!!
 
Try (after some event on the Main Form)...

Code:
Me.[B][COLOR=red]InsertYourSubformNameHere[/COLOR][/B].Setfocus
DoCmd.RunCommand accmdRecordsGoToLast

Side note: You will need some event to *trigger* this, i.e. a Command Button or perhaps in the After_Update event of a Combo Box but something has to trigger this event.
 
And make sure your records are sorted the way you want them by using a query. Otherwise you may not be getting the first and last records that you are hoping to get.
 

Users who are viewing this thread

Back
Top Bottom