open form to automatically show the last record entered

sheesh.katie

Registered User.
Local time
Today, 15:14
Joined
Aug 8, 2012
Messages
10
Good morning!

This is something that should be simple, but for some reason I can't figure it out and can't seem to find the answer anywhere.

I am trying to get my form to automatically show the last record whenever it is opened. Nothing that I find seems to work. Usually, it has involved something like this:

DoCmd.GoToRecord , , acLast

...and either they haven't worked or it gives me an error message. Could somebody slip me a code and location for this? Or tell me what I'm supposed to change that I'm missing.

Thanx!:)
 
Try this (from Allen Browne) in your Form's load event

Code:
 Private Sub Form_Load()
        If Not Me.NewRecord Then
            RunCommand acCmdRecordsGotoLast
        End If
    End Sub
 
That didn't work either. :(
If it helps at all, my form is called CopyofRecycleForm.

I'm not sure why nothing is working. I put it in the On Load event in the Event section for the form. Should I be using that for the ID instead or am I doing something wrong or..?
 
We know jDraw's form load event is correct , so how are you opening the form? is there a find first command that is over riding the load event ? If you are opening the form from a switchboard have a look at the coding of that command button. A further test you could try is to create a new temp command button using the wizard to open your form and see what record is opened. Check the other events of the form perhaps one of them is over riding the load even

Best of Luck for a fellow user .
 
...and either they haven't worked or it gives me an error message. Could somebody slip me a code and location for this? Or tell me what I'm supposed to change that I'm missing.

Thanx!:)
What is the error message?
What is the value of the form's Data Entry property?
Is your form based on a Table or a Query?
 
"Last" is not the last record entered. It is the last record in the recordset which is not the same thing. The simplest way to open showing the "newest" record is to sort descending by the autonumber. Or, by the LastUpdateDate if you want to include updated records.
 
Okay - Here's a few things copied from my database just so I could show you better.. hopefully!

On the Navigation Form, there are two tabs: New Entry (which works fine) and Review Previous Transaction (which is the one I am referring to).
The Review Previous Transaction tab is supposed to show, obviously, the last record that was entered. (Ex: You enter a new entry on the new entry form and close it. The Review Previous Transaction should show the one that was just entered.) Does that make sense?

I'm new. I'm not very good at all of this. :o Ignore the rest of the tabs, I just copied as much as I could upload.. which isn't much. On the Navagation Pane, Recycle Form is the form used for New Entry. There is a "copy of Recycle Form" over there as well because I figured if I used the same form twice, it would make the new entry show the last record, too, instead of being blank, which I don't want. That's why Review Previous Transaction is blank right now. I wasn't sure what to do exactly.
 

Attachments

Let me know if you need more to my database, although I don't think you should. All of it is connected to the "main" table. And specific fields are connected to their specific tables, as well, like Recycle Station goes to Recycle Area, etc.
 
When a form's data entry property is set to yes, it always opens to an empty recordset. As you add records they accumulate and you can scroll forward and back within that set of records. When you close and reopen the form, the form opens to an empty recordset again.

If you want the second form to show the most recent ("last" has no meaning in database terms since record order is fluid), you need to set the form's data entry property to No and either reference the newest record specifically or do what I said earlier and create a query that sorts the recordset in descending order by date/time entered or autonumber.
 

Users who are viewing this thread

Back
Top Bottom