Move to Last Record

  • Thread starter Thread starter R. BRADFORD THOMAS
  • Start date Start date
R

R. BRADFORD THOMAS

Good Evening,
I use Windows2000 and Access2000.

I have a form that uses a query, Query1. When I open the form I want the
"Last" record to to appear.

How do I make this happen???

Brad
 
In the OnLoad event of the form, move the recordset to the last record:

Private Sub Form_Load()
With Me.Recordset
If .EOF = False and .BOF = False Then .MoveLast
End With
End Sub
 
R. BRADFORD THOMAS said:
I use Windows2000 and Access2000.

I have a form that uses a query, Query1. When I open the form I want the
"Last" record to to appear.


Assuming the form's record source is sorted from earliest to
latest:

With Me.RecordsetClone
If .RecordCount > 0 Then
.MoveLast
Me.Bookmark = .Bookmark
End If
End With
 
Brad

Marsh's reply offered an assumption ...

So, what do YOU mean by "Last" -- and are you quite certain that Access
means the same thing?
 
Thank you Ken.

Brad

Ken Snell said:
In the OnLoad event of the form, move the recordset to the last record:

Private Sub Form_Load()
With Me.Recordset
If .EOF = False and .BOF = False Then .MoveLast
End With
End Sub
 
Thank you Marshall.

Brad

Marshall Barton said:
Assuming the form's record source is sorted from earliest to
latest:

With Me.RecordsetClone
If .RecordCount > 0 Then
.MoveLast
Me.Bookmark = .Bookmark
End If
End With
 
Ken your response worked fine. I am a bit ashamed to ask, but now that I am
at the end, how do I add a new Record??

Brad
 
You don't need to move to the "last" record if you want to add a new record.
Just use this:

Private Sub Form_Load()
Me.Recordset.AddNew
End Sub

Note that, if you want to always add a new record in this form, then just
set the form's DataEntry property to Yes. That will always start on a new
record when the form opens; it also means that the previously entered
records aren't visible/accessible.
 
Thank you very much Ken.

Brad

Ken Snell said:
You don't need to move to the "last" record if you want to add a new record.
Just use this:

Private Sub Form_Load()
Me.Recordset.AddNew
End Sub

Note that, if you want to always add a new record in this form, then just
set the form's DataEntry property to Yes. That will always start on a new
record when the form opens; it also means that the previously entered
records aren't visible/accessible.

--

Ken Snell
<MS ACCESS MVP>

I
 
Back
Top