Hi Everyone,
I need a bit of help with a simple error handles. I have this code in a dbl click event of a listbox. The error occurs when there is no records to match the filter.
I also have this code in the on current event of a form
When I step through the code in the list box, the error actually occurs in the code located in the on current event of the form. I am trying to trap the error in the listbox dbl click event . . but it's not catching it there? I moved the error handler to on current event, but once I trap the error there, the code continue from where it left off in the dbl click event and I get a second error. I would be grateful for any help!
I need a bit of help with a simple error handles. I have this code in a dbl click event of a listbox. The error occurs when there is no records to match the filter.
Code:
On Error GoTo MyErrHandler
Rem FILTER BY SELECTION
Me.Filter = "[StockPrice] = 'UnderV' And " & "[" & MyField & "]" & MyStr
Me.FilterOn = True
Me.OrderBy = True
Exit Sub
MyErrHandler:
MsgBox Err.Number: Exit Sub
I also have this code in the on current event of a form
Code:
Dim rst As DAO.Recordset
Dim lngCount As Long
Set rst = Me.RecordsetClone
With rst
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
Rem SHOW RECORD NUMBER IN TXTBOX
Me.txtNavigation = "You are at record " & Me.CurrentRecord & " of " & lngCount
When I step through the code in the list box, the error actually occurs in the code located in the on current event of the form. I am trying to trap the error in the listbox dbl click event . . but it's not catching it there? I moved the error handler to on current event, but once I trap the error there, the code continue from where it left off in the dbl click event and I get a second error. I would be grateful for any help!