Solved Opening last record in navigation control tab (1 Viewer)

dyn

New member
Local time
Today, 22:09
Joined
Mar 28, 2023
Messages
4
Hi there.
I am new here. I'm haviung a prolem with Access and I can't find the solution anywhere so I hope that someone here will be able to help me.
In my Database I have a "Main Menu" form which has "double" set od tabs. So first there are tabs "Inevntory", "Invoicing", etc. When you click "Inventory" the other set of navigation tabs shows "New Item", "New user", "Lending", etc. All of this was created using the "Naviagtion Control" from "Form Design" tab. What I need is when I (for example) go to "Inventory" and then "New Item", the form that opens (New Item Entry) needs to show the last record entered. How do I do that? I have tried a bunch of dfferent things and nothing worked. This tutorial:
wasn't usefull because in my case these arent buttons that open another pop-up form but Navigation form which is all-in-one pop-up.

Update:
I have managed to add this code

Private Sub MainMenu_NavigationSubform_Enter()
DoCmd.RunCommand acCmdRecordsGoToLast
End Sub

but what happens is it loads the latest record when I open the form for the first time, but then when I (for example) go to "New user" it starts from the first record and then when I go to "New item" it is also back to first record.
Note: MainMenu_NaviagtionSubform is my name for the subform that opens after you select "News user" or "New item".
 
Last edited:

LarryE

Active member
Local time
Today, 13:09
Joined
Aug 18, 2021
Messages
592
With each forms OnLoad Event, use:
DoCmd.GoToRecord acActiveDataObject, , acLast
which will present the last record when the form is loaded.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:09
Joined
Oct 29, 2018
Messages
21,474
Hi. Welcome to AWF!

You could also try the BrowseTo method or the Filter property.

Sent from phone...
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:09
Joined
May 21, 2018
Messages
8,529
I have never used one of these because of their limitations but maybe something like this which worked form me.
Me.NavigationSubform.Form.Recordset.MoveLast
 

dyn

New member
Local time
Today, 22:09
Joined
Mar 28, 2023
Messages
4
With each forms OnLoad Event, use:
DoCmd.GoToRecord acActiveDataObject, , acLast
which will present the last record when the form is loaded.
This worked. Thank you so much!
 

dyn

New member
Local time
Today, 22:09
Joined
Mar 28, 2023
Messages
4
I have never used one of these because of their limitations but maybe something like this which worked form me.
Me.NavigationSubform.Form.Recordset.MoveLast
Yeah, I have heard from a lot of people that hey don't like using Navigation Control and that most of them like just having buttons open different pop-ups, but I have decided to use this because it seems much more simple to use. Considering that my Database is still work in progress, I might change it to have multiple forms and when you click on a Button it opens the window that looks the same but is in fact a different form and than have it close the original form and that's it. For the end user (I am making this DataBase for a customer) it will look and feel the same but it might be easier for me. Thank you for your advice btw
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:09
Joined
May 21, 2018
Messages
8,529
You do not necessarily need multiple forms, but you can use a standard tab control with subforms on each tab.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:09
Joined
Feb 19, 2002
Messages
43,280
but it might be easier for me.
It won't be.

Also, keep in mind that goto LAST won't necessarily get you to the most RECENT record. It just goes to the last physical row in the recordset. So, make sure your recordset is sorted on something that will make the record you want show up "last".
 

Users who are viewing this thread

Top Bottom