G
gagecres
I would like to add my own record counter, like "Record # of #", to my form.
How can I do this?
How can I do this?
Here is the code I am using:
With Me.RecordsetClone
.MoveLast
Me.txt_Rec_Count.Value = Me.CurrentRecord & " of " & .RecordCount &
" line(s)"
End With
Also, I commented out the OnLoad lines
[quoted text clipped - 60 lines]Please post the exactly the code you are using here... And if you have no
reason for the DoCmd.GoToRecord lines, remove them from the On_Load event.
BruceM via AccessMonster.com said:Try checking the RecordCount of RecordsetClone, and breaking up the code a
little:
Debug.Print Me.RecordsetClone.RecordCount
Me.RecordsetClone.MoveLast
Me.txt_Rec_Count = Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount
& " line(s)"
Rather than using the Load event, perhaps something like this:
Dim lngCount as Long
Dim strCount as String
lngCount = Me.RecordsetClone.RecordCount
If lngCount = 0 Then
strCount = "First Record"
Else
strCount = Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount & "
line(s)"
End If
Me.txt_Rec_Count = strCount
Here is the code I am using:
With Me.RecordsetClone
.MoveLast
Me.txt_Rec_Count.Value = Me.CurrentRecord & " of " & .RecordCount &
" line(s)"
End With
Also, I commented out the OnLoad lines
[quoted text clipped - 60 lines]Please post the exactly the code you are using here... And if you have no
reason for the DoCmd.GoToRecord lines, remove them from the On_Load event.
--
.
gagecres said:This did the trick. Thanks a lot!
BruceM via AccessMonster.com said:Try checking the RecordCount of RecordsetClone, and breaking up the code a
little:
Debug.Print Me.RecordsetClone.RecordCount
Me.RecordsetClone.MoveLast
Me.txt_Rec_Count = Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount
& " line(s)"
Rather than using the Load event, perhaps something like this:
Dim lngCount as Long
Dim strCount as String
lngCount = Me.RecordsetClone.RecordCount
If lngCount = 0 Then
strCount = "First Record"
Else
strCount = Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount & "
line(s)"
End If
Me.txt_Rec_Count = strCount
Here is the code I am using:
With Me.RecordsetClone
.MoveLast
Me.txt_Rec_Count.Value = Me.CurrentRecord & " of " & .RecordCount &
" line(s)"
End With
Also, I commented out the OnLoad lines
Please post the exactly the code you are using here... And if you have no
reason for the DoCmd.GoToRecord lines, remove them from the On_Load event.
[quoted text clipped - 60 lines]
.
--
.
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.