Go to last 'null' record

G

Guest

I have a form listing people. On the form there is a start date and end date
[enddate]. The form is sorted such that first are the folks with null end
date, then everyone else.

I would like to add a button to quickly jump to the last 'current'
person/record.

Any suggestions would be appreciated.
 
A

Allen Browne

The event procedure for the click event of your button will be something
like this:

Private Sub cmdGo_Click()
Dim rs As DAO.Recordset

If Me.Dirty Then 'Save any edits in progress.
Me.Dirty = False
End If

Set rs = Me.RecordsetClone
rs.FindLast "[enddate] is null"
If rs.NoMatch Then
MsgBox "Not found"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub
 

Ask a Question

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.

Ask a Question

Top