gojets1721
Registered User.
- Local time
- Today, 04:58
- Joined
- Jun 11, 2019
- Messages
- 429
I've got a custom nav controls in my form (first & last button, current record #, total records) using the following code for the current record #:
It works perfectly except when I use one of my filter buttons. If I press the filter and it filters to 0 records (it constantly flucuates), I get a 3021 error stating no current record. The debugger keys on the ".MoveFirst" line.
Not a huge issue, I'm just OCD about error messages. It'd be nice if that didn't pop up and it just filtered to 0 records. Any idea how to get rid of this error message?
Here's one of my filters' code:
Code:
Private Sub Form_Current()
Dim rst As DAO.Recordset
Dim lngCount As Long
Set rst = Me.RecordsetClone
With rst
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
Me.txtNavControls = Me.CurrentRecord & " of " & lngCount
End sub
It works perfectly except when I use one of my filter buttons. If I press the filter and it filters to 0 records (it constantly flucuates), I get a 3021 error stating no current record. The debugger keys on the ".MoveFirst" line.
Not a huge issue, I'm just OCD about error messages. It'd be nice if that didn't pop up and it just filtered to 0 records. Any idea how to get rid of this error message?
Here's one of my filters' code:
Code:
Private Sub btnInProgress_Click()
Me.Filter = "[Status]= 'In Progress'"
DoCmd.SetOrderBy "[ComplaintDate] ASC"
Me.FilterOn = True
End Sub