Record count results not consistent

  • Thread starter Thread starter Jenno
  • Start date Start date
J

Jenno

I have a form with 2 labels, one for the current record (lblRecCount),
the other for the total records (lblTotRec). I use the following code
after a filter is set to capture the total records:

Me.RecordsetClone.MoveLast
lblTotRec.Caption = Me.RecordsetClone.RecordCount

....and the following code to update the current record each time the
user moves between records:

Private Sub Form_Current()
lblRecCount.Caption = Me.Recordset.AbsolutePosition + 1
End Sub

This works fine on my computer all the time, however, another user with
their own copy of the db gets odd results as they move through the
records. The first record displays as record #2 and the second as
record #1, records 3 onwards are ok until they get to the last 2
records when tranposition reoccurs.

Any thoughts?

Thanks in advance.
 
I have a form with 2 labels, one for the current record (lblRecCount),
the other for the total records (lblTotRec). I use the following code
after a filter is set to capture the total records:

Me.RecordsetClone.MoveLast
lblTotRec.Caption = Me.RecordsetClone.RecordCount

...and the following code to update the current record each time the
user moves between records:

Private Sub Form_Current()
lblRecCount.Caption = Me.Recordset.AbsolutePosition + 1
End Sub

This works fine on my computer all the time, however, another user with
their own copy of the db gets odd results as they move through the
records. The first record displays as record #2 and the second as
record #1, records 3 onwards are ok until they get to the last 2
records when tranposition reoccurs.

Any thoughts?

Thanks in advance.

Do you base the form on a sorted query, or just on the table? You need
to have the former for this to work properly.
 
Interesting....It is based on the table, not a sorted query and to
modify now would cause me a lot of heartburn!
Any thoughts on why it has always worked ok for me, but does not for my
other user?

Thanks
 
Why not put this in the form's current event, and just use one label
(lblNavigate)? :

Dim lngCount As Long
lngCount = 0
With Me.RecordsetClone
If .RecordCount > 0 Then
If lngCount = 0 Then
.MoveLast
End If
lngCount = .RecordCount
If Me.CurrentRecord > lngCount Then
Me.lblNavigate.Caption = "Record " &
Me.CurrentRecord
Else
Me.lblNavigate.Caption = "Record " &
Me.CurrentRecord & " of " & lngCount
End If
End If
End With

HTH
Damon
 
Back
Top