record counting

J

JohnE

I am replacing the Access record counting with a textbox in the footer
(txtNumber) and using the following code placed in the forms OnCurrent event.


Dim lngCount As Long
Set rst = Me.Recordset.Clone

If rst.EOF = False Then
With rst
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
Me.txtNumber = "Record " & Me.txtNumber & " of " & lngCount

Else
Me.txtNumber = "Record 0" & " of 0"

End If

It is Access 97 and the code fails at the Recordset word of the Set rst =
Me.Recordset.Clone line. All of this works in A2k and after. Is there
something else that should be used for Access 97?

Thanks for reviewing.

.... John
 
G

George Nicholson

Do you have a reference to the DAO (Data Access Objects) library set? The
complier won't know anything about Recordset unless you do.
 
K

Klatuu

Actually, both are correct.
To the OP

The method you are using will really slow your form down. An easier way
would be:

With Me
.txtNumber = .Recordset.Absolute Position & " of " &
..Recorset.RecordCount
End With
 
G

George Nicholson

Actually, both are correct.

For some reason, I didn't think Forms had a Recordset property in 97, just
Recordsetclone. My bad.
 
D

Douglas J. Steele

Much as I hate to argue with Dave, you were correct, George. Forms in Access
97 did not have a Recordset property.

You do need to use the RecordsetClone property in Access 97.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

RECORDSET 2
function assistance 2
Code Is Slow 3
Code Is Slow 6
Record numbers 4
RecordCount clarification 2
First / Last nav button disable 1
Scroll to record in continuous subform 6

Top