Find Record

  • Thread starter Thread starter Tamer
  • Start date Start date
T

Tamer

I developed an app and hide the toolbars and the menu bar
from users. In one of the forms, I want to have a cmd
button that will allow users to search for records (like
the find function on the edit menu). How can i do that?

Thanks in advance
 
I accomplish this by putting a combobox on a form, and using this code in
the AfterUpdate event for the ComboBox:

Private Sub cboSearchReports_AfterUpdate()
Screen.PreviousControl.SetFocus ' Optional line
Me.Recordset.FindFirst "ReportID=" & Me.cboSearchReports
End Sub

There are many other ways to perform the search. If a command button is
used, you could pop up an InputBox, or a small form just to hold a search
ComboBox. The comboBox works nicely for searching records because the
dropdown displays the existing records, but the user can also type into the
box and move the starting point for the records in the list.

If you use a popup form, you'll have to reference the original form's
recordset object in the code of the AfterUpdate event.

HTH
Paul
 
Thanks for your help. Your way worked well and I tried
also the following and it worked:


Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
 
Back
Top