Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

last record on continuous form

Status
Not open for further replies.

smuthcrmnl777

Technical User
Jan 16, 2006
104
0
0
US
I have a continuous form that when I open the form it goes to the last record. It does everything I want it to do except I would like for it to go to the last record without placing the last record at the top of the screen. I would to have it go to the last record and have the record displayed at the bottom of the screen. This tends to confuse some people into thinking there is only one record in the database.

What can I do.

Thanks!!
 
You can try

DoCmd.GoToRecord , , acLast

Pampers [afro]
Just let it go...
 
or:
Code:
[blue]DoCmd.RunCommand acCmdRecordsGoToLast[/blue]

Calvin.gif
See Ya! . . . . . .
 
I'm of a mind that you need to be more specific. When I tried going to the last record in code awhile back, it only displayed the last record - hence the OP's question.

I use the following to display the last five records when the form opens. Depending on your layout, you may only want one or two extras showing.
Code:
[COLOR=green] 'bring the fifth record from the end to the top of the screen[/color]
DoCmd.GoToRecord , , acGoTo, Form.Recordset.RecordCount - 5
[COLOR=green]'set focus on the last record[/color]
DoCmd.GoToRecord , , acLast



HTH

John


Life is short.
Build something.
 
Box head: I am able to go to the last record. I am asking how to make it so it displays abunch of data on the screen instead of having the last record appear at the top of the page.
 


That's what I said. In my example, the last record should be the fifth one down from the top as long as five or more records can be displayed on the page at a time.

Life is short.
Build something.
 
Does not work when I am opening the form. It works if I am switching between design view and form view.

And by the way I have the command on load.
 
What code do you have that throws the focus to the last recor? By default, when I create a continuous form, it will open to the first record. Look for another event that's moving it to the last record after the form loads.

I created a quick continuous form to re-test the code and it works when I open the form. I have the code on the Load event as well.



Life is short.
Build something.
 
Another option would be to sort your query in descending order, forcing the last record to appear on top and the first record on bottom.

Just a thought.


Randy
 
smuthcrmn777,

Didn't mean to leave you hanging. I could have sworn I submitted a reply to you 6/8 post...

If you comment out the code on the Load event that throws the focus to the last record, does the form open to the first record in the recordset?

If it doesn't, do a CTRL+F search in your module to see if there's any other event throwing the focus to the last record.

Let me know what you find.



John



Life is short.
Build something.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top