Find Record Command Button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a form based on a query with defined fields. I set up a Find
Record command button to locate records for update. I need to find a record
and have it populate the text boxes with the appropriate information. What do
I need to do in order to make this happen?
 
j1eggert said:
I have created a form based on a query with defined fields. I set up
a Find Record command button to locate records for update. I need to
find a record and have it populate the text boxes with the
appropriate information. What do I need to do in order to make this
happen?

Make sure the Toolbox wizard is enabled and drop a new ComboBox control on
the form. One of the options in the wizard does exactly what you want. It
configures the ComboBox as a "Go to this record..." tool.

The form needs to be bound to a table or a saved query for this option to be
available in the wizard. If your form is currently bound to a SQL
statement, just change that to a saved query (the change can be temporary if
you prefer).
 
In the form's design view, place a command button on the form, a wizard
displays. Read each instruction closely. Once the wizard finishes, I find
it helpful to go into the form's code module and insert a .Setfocus line, as
follows:

Private Sub cmdFind_Click()
On Error GoTo Err_cmdFind_Click

<control's name>.SetFocus 'INSERT THIS LINE HERE with you control's name.

DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_cmdFind_Click:
Exit Sub

Err_cmdFind_Click:
MsgBox Err.Description
Resume Exit_cmdFind_Click

End Sub
 
Back
Top