By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,479 Members | 2,260 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,479 IT Pros & Developers. It's quick & easy.

Record x of y

P: n/a
I've used the following code to recreate the record count on a form,
where it says Record 1 of 200 or whatever.

Why would this work normal on most forms, but on a few it shows Record
1 of 1 when first opened. After you go to the next record it shows the
correct count.
Private Sub Form_Current()
If Me.NewRecord Then
Me!lblNavigate.Caption = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me!lblNavigate.Caption = "Record " & _
.AbsolutePosition + 1 _
& " of " & .RecordCount
End With
End If
End Sub

Thanks,
Ken

Jan 16 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Ken Mylar wrote:
I've used the following code to recreate the record count on a form,
where it says Record 1 of 200 or whatever.

Why would this work normal on most forms, but on a few it shows Record
1 of 1 when first opened. After you go to the next record it shows the
correct count.
Private Sub Form_Current()
If Me.NewRecord Then
Me!lblNavigate.Caption = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me!lblNavigate.Caption = "Record " & _
.AbsolutePosition + 1 _
& " of " & .RecordCount
End With
End If
End Sub

Thanks,
Ken


Jan 16 '06 #2

P: n/a
Sorry, I searched the group first and didn't find what I was looking
for, but I searched again using the title I used, Record x of y and
found my answer.

If anyone is interested, this fixed it.

Thanks,
Ken
Private Sub Form_Current()
Dim rs As DAO.Recordset

If Me.NewRecord Then
Me!lblNavigate.Caption = "New Record"
Else
With Me.RecordsetClone
Set rs = Me.RecordsetClone
rs.MoveLast
rs.MoveFirst

.Bookmark = Me.Bookmark
Me!lblNavigate.Caption = "Record " & _
.AbsolutePosition + 1 _
& " of " & .RecordCount

rs.Close

End With
End If
End Sub

Jan 16 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.