reddwarf999
New member
- Local time
- Yesterday, 20:24
- Joined
- Apr 7, 2014
- Messages
- 3
Hi all,
Access/VBA noob using Access 2003. My DB is for loaning equipment to users. Got pretty much everything working well but someone asked if this could be done: When the Find Next button reaches the last record matching criteria, have a MsgBox indicate so to the user ie: "Search complete.No further records found."
Form is bound to a table. Find Next button is unbound with fol code:
Private Sub cmdModelFindNext_Click()
On Error GoTo Err_cmdModelFindNext_Click
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindNext "[Model]='" & Me.Model & "'"
Me.Bookmark = rst.Bookmark
Exit_cmdModelFindNext_Click:
Set rst = Nothing
Exit Sub
Err_cmdModelFindNext_Click:
MsgBox Err.Description
Resume Exit_cmdModelFindNext_Click
End Sub
It has no problem finding the next record. When it reaches the last matching record it remains on that record and some of the Users think it has locked up and is not at the last matching record.
I've tried using rst.EOF in a variety of ways to call a MsgBox to no avail.
Any suggestions would be appreciated. Thanks in advance.
Doug
P.S. 99.9% of my VBA knowledge comes from forums like this. The other .1% is lost due to memory leakage.
Access/VBA noob using Access 2003. My DB is for loaning equipment to users. Got pretty much everything working well but someone asked if this could be done: When the Find Next button reaches the last record matching criteria, have a MsgBox indicate so to the user ie: "Search complete.No further records found."
Form is bound to a table. Find Next button is unbound with fol code:
Private Sub cmdModelFindNext_Click()
On Error GoTo Err_cmdModelFindNext_Click
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindNext "[Model]='" & Me.Model & "'"
Me.Bookmark = rst.Bookmark
Exit_cmdModelFindNext_Click:
Set rst = Nothing
Exit Sub
Err_cmdModelFindNext_Click:
MsgBox Err.Description
Resume Exit_cmdModelFindNext_Click
End Sub
It has no problem finding the next record. When it reaches the last matching record it remains on that record and some of the Users think it has locked up and is not at the last matching record.
I've tried using rst.EOF in a variety of ways to call a MsgBox to no avail.
Any suggestions would be appreciated. Thanks in advance.
Doug
P.S. 99.9% of my VBA knowledge comes from forums like this. The other .1% is lost due to memory leakage.