Thank you. When I do this it says "Record 1 of 1" on the first record when
there are 6 existing records. If I move forward one it says "Record 2 of 6"
(okay). If I go back one from there it says "Record 1 of 1" (not okay). If
I move forward two and then back two it says "Record 1 of 6" (okay). It
always says "Record 1 of 1" (not okay) when I first display the form.
I've never had this problem with this code, but I have heard of others who
have! The usual answer is to move to the lasrt record then back to the first
record.
Private Sub Form_Load()
DoCmd.GoToRecord , , acLast
DoCmd.GoToRecord , , acFirst
End Sub

Signature
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000/2003
Dirk Goldgar - 25 Nov 2007 20:41 GMT
> I've never had this problem with this code, but I have heard of others who
> have! The usual answer is to move to the lasrt record then back to the
[quoted text clipped - 5 lines]
> DoCmd.GoToRecord , , acFirst
> End Sub
Does it work to do this in the RecordsetClone, which might be less
noticeable:
With Me.RecordsetClone
If Not .EOF Then .MoveLast
End With
?

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Robert - 25 Nov 2007 21:28 GMT
I'm using a subform for this. Where would I put this code?
>> I've never had this problem with this code, but I have heard of others
>> who
[quoted text clipped - 15 lines]
>
> ?
Dirk Goldgar - 27 Nov 2007 02:13 GMT
> I'm using a subform for this. Where would I put this code?
Is the subform related to the current record on the main form, so that it
has a different set of records to display depending on which record is
displayed on the main form?

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Robert - 25 Nov 2007 21:24 GMT
It is actually a subform. Maybe that has something to do with it.
> I've never had this problem with this code, but I have heard of others who
> have! The usual answer is to move to the lasrt record then back to the
[quoted text clipped - 5 lines]
> DoCmd.GoToRecord , , acFirst
> End Sub
Robert - 25 Nov 2007 21:32 GMT
Clicking Last and then First on either form does not work. Clicking Next
twice and then Previous twice always seems to work.
> I've never had this problem with this code, but I have heard of others who
> have! The usual answer is to move to the lasrt record then back to the
[quoted text clipped - 5 lines]
> DoCmd.GoToRecord , , acFirst
> End Sub
> When I do this it says "Record 1 of 1" on the first record when
> there are 6 existing records. If I move forward one it says
> "Record 2 of 6" (okay). If I go back one from there it says
> "Record 1 of 1" (not okay). If I move forward two and then back
> two it says "Record 1 of 6" (okay). It always says "Record 1 of
> 1" (not okay) when I first display the form.
DAO recordsets use Rushmore technology to populate themselves. What
this means is that the first few records of the recordset become
available before the end of the recordset has been fully loaded. I'm
sure you've seen this in many instances.
The .RecordsetCount property of a recordset is not accurate until
the recordset has been fully loaded. To force this to happen, you
have to .MoveLast. So, in your subform's LOAD event:
Me.RecordsetClone.MoveLast
Me.RecordsetClone.MoveFirst
Now Me.RecordsetClone.RecordCount will be accurate.
The other thing to remember is that .Recordset will be 0 if no
records are returned and 1 or more if there are records returned.
So, if you want to know if a recordset has records in it, you need
only check if the RecordCount is 0 or not. You need to .MoveLast
only when you need the exact count.
When I'm checking if a recordset has records, I just test
.RecordCount = 0, rather than .EOF And .BOF. I think it's more
efficient to check one property that can always be counted on to
behave consistently rather than checking two.

Signature
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Robert - 26 Nov 2007 01:52 GMT
Thank you.
>> When I do this it says "Record 1 of 1" on the first record when
>> there are 6 existing records. If I move forward one it says
[quoted text clipped - 27 lines]
> efficient to check one property that can always be counted on to
> behave consistently rather than checking two.