Finding Records

  • Thread starter Thread starter DS
  • Start date Start date
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
 
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/
 
Back
Top