Error on move.last

  • Thread starter Thread starter Rpettis31
  • Start date Start date
R

Rpettis31

How do I avoid an error with the following code or resume next,
This occurs when a filter is placed on a form based on a record status such
as open, in process or closed.

Me.Dynaset.MoveLast
Me.txtRecordTotal = Me.Dynaset.RecordCount

I get the error on the above code in the on current event on my form.
 
Rpettis31 said:
How do I avoid an error with the following code or resume next,
This occurs when a filter is placed on a form based on a record status
such
as open, in process or closed.

Me.Dynaset.MoveLast
Me.txtRecordTotal = Me.Dynaset.RecordCount

I get the error on the above code in the on current event on my form.


What version of Access are you using? I could be wrong, but that looks like
Access 2.0 code. If you're using anything since Access 95, I think maybe
you would do better to use something like this:

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

That code assumes that you don't actually want to move the form to the last
record, but just want to get the record count. If I'm wrong about that, let
me know.
 
Back
Top