ImLost
Registered User.
- Local time
- Today, 02:30
- Joined
- Nov 16, 2005
- Messages
- 44
Hi - I'm fairly new to Access and have jumped in head first. I do not know much about it, but I am very familiar with the other MS programs. I also don't know anything about visual basic.
I found an article online that described how to put in a custom record counter by using the Oncurrent Event. I have a form with a subform and I'd like have a custom record counter on both, however, when I open a new record, I get an error telling me there is no current record. This is more a problem for the subform, as the message pops up repeatedly until I put something into it to make it a current record.
The error is run-time error '3021': No Current Record.
This is the code that I used (keep in mind that I only copied this and used it, I didn't write it):
Private Sub Form_Current()
' Provide a record counter for using with
' custom navigation buttons (when not using
' Access built in navigation)
Dim rst As DAO.Recordset
Dim lngCount As Long
Set rst = Me.RecordsetClone
With rst
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
'Show the result of the record count in the text box (txtRecordNo)
Me.txtRecordNo = "Record " & Me.CurrentRecord & " of " & lngCount
End Sub
Any help is appreciated. Thanks!!
I found an article online that described how to put in a custom record counter by using the Oncurrent Event. I have a form with a subform and I'd like have a custom record counter on both, however, when I open a new record, I get an error telling me there is no current record. This is more a problem for the subform, as the message pops up repeatedly until I put something into it to make it a current record.
The error is run-time error '3021': No Current Record.
This is the code that I used (keep in mind that I only copied this and used it, I didn't write it):
Private Sub Form_Current()
' Provide a record counter for using with
' custom navigation buttons (when not using
' Access built in navigation)
Dim rst As DAO.Recordset
Dim lngCount As Long
Set rst = Me.RecordsetClone
With rst
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
'Show the result of the record count in the text box (txtRecordNo)
Me.txtRecordNo = "Record " & Me.CurrentRecord & " of " & lngCount
End Sub
Any help is appreciated. Thanks!!
