Duplicate X of Y

K

Kurt

I’m trying to duplicate the “Record X of Y†feature using a control on a
subform. I’ve tried 3 different methods and each one gives me a problem:

1. I used an unbound control with a control source of:

="Record" & " " & [CurrentRecord] & " of " & Form.Recordset.RecordCount

.. . . but the control would show “Record 1 of 0†for starters, and then as I
add records: “Record 2 of 1â€, “Record 3 of 2â€, etc. The total RecordCount
doesn’t refresh until I leave and then return to the form.

2. So I tried this method - http://www.mvps.org/access/forms/frm0026.htm -
but got:

Run-time error 438:
Object doesn’t support this property or method.

3. And then I tried this method -
http://easyweb.easynet.co.uk/~trevor/AccFAQ/forms.htm#RecXY –but my control
showed:

#Name

----

Any recommendations about the best way to duplicate the Record X of Y using
a custom control?

Thanks.

Kurt
 
D

Dirk Goldgar

Kurt said:
2. So I tried this method -
http://www.mvps.org/access/forms/frm0026.htm - but got:

Run-time error 438:
Object doesn't support this property or method.

There's an error in that code, it appears. Try this revised version:

'----- start of revised code -----
Private Sub Form_Current()

If Me.NewRecord Then
Me!lblNavigate.Caption = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me!lblNavigate.Caption = "Record " & _
Me.CurrentRecord _
& " of " & .RecordCount
End With
End If

End Sub
'----- end of revised code -----
 

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

Top