Open a subform and display the last bottom record (1 Viewer)

rickyfong

Registered User.
Local time
Today, 09:25
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!!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:25
Joined
Aug 30, 2003
Messages
36,118
Look at GoToRecord and see if it does what you want.
 

rickyfong

Registered User.
Local time
Today, 09:25
Joined
Nov 25, 2010
Messages
199
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.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:25
Joined
Aug 30, 2003
Messages
36,118
I'm not familiar with that technique, so perhaps following up on the thread where you found it would be appropriate?
 

rickyfong

Registered User.
Local time
Today, 09:25
Joined
Nov 25, 2010
Messages
199
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!!
 

rickyfong

Registered User.
Local time
Today, 09:25
Joined
Nov 25, 2010
Messages
199
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!!
 

vbaInet

AWF VIP
Local time
Today, 16:25
Joined
Jan 22, 2010
Messages
26,374
What field can you use to indicate the first and last records?
 

rickyfong

Registered User.
Local time
Today, 09:25
Joined
Nov 25, 2010
Messages
199
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!!
 

GinaWhipp

AWF VIP
Local time
Today, 12:25
Joined
Jun 21, 2011
Messages
5,901
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.
 

vbaInet

AWF VIP
Local time
Today, 16:25
Joined
Jan 22, 2010
Messages
26,374
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

Top Bottom