Finding Records

D

DS

How do you find a record on a form that is alresdy open? I have a form
that is open. I click a command button and a list of numbers pop up. I
want to hit another command button and have it find the record on the
first form. I'm using a where clause now, the first form closes and
reopens on a where clause. I'm sure there is a cleaner way to do that.
Thanks
DS
 
M

Mark Phillipson

Hi,

Try creating a ComboBox or ListBox if you prefer that includes the Primary
Key in the first column (probably hidden). It should also be in the forms
Header and be unbound.

Then write code like the following in the controls AfterUpdate Event:

' Find the record that matches the control.
Dim rs As Object
If Not IsNull(Me![cboSelect]) Then
Set rs = Me.Recordset.Clone
rs.FindFirst "[id] = " & Me![cboSelect]
Me.Bookmark = rs.Bookmark
End If


--
HTH

Mark Phillipson

Free Add-Ins at; http://mphillipson.users.btopenworld.com/
 

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