Find a record

  • Thread starter Thread starter Bruce
  • Start date Start date
B

Bruce

Maybe I'm missing something here. I want to have a combo
box to locate a name from a query. I can do that. Now I
want the rest of the form to contain information such as
address and phone from the same record as the name in the
combo box. I believe this is an event procedure, but it
is not a macro. Access Help tells me that for an event
procedure it will automatically put in Sub and EndSub, and
all I have to do is add the code in between. This is not
helpful, unless I have some idea of how to do that. On
this point Help is silent.
So now I ask a very elementary question: How do I pick a
name from a combo box and have other information from the
same record appear elsewhere in the form? Do I need to
know programming?
 
A little.
Open your form in design view. Select your combo, bring up the property
sheet. Go to Events, find AfterUpdate. Click once on the empty line next
to "AfterUpdate" and select "Event Procedure". Now, click on the [...]
on the right of the [Event procedure]. It will open up VBA editor and
allow you to enter the code. It will have Sub and End Sub.
Between them, put something like this:

Me.Recordset.FindFirst "SearchField = '" & Me.MyCombo.Column(1) & "'"

You need to replace SearchField with the name of the field you are
searching, MyCombo with the name of the combo box (you can see that in
the header - Private Sub >>>MyCombo<<<_AfterUpdate), and (1) with the
number of column in the combo box that contains the search criteria.

Good luck,
Pavel
 
Try building a nice form with all the information.

Then, use the combo box wizard to "add" a search combo. This combo box will
do what you want. You can then later examine the "code" that the wizard
creates for you.

Regardless...use the wizard. Those wizards in ms-access are a great time
saver, and also a great helper.
 
Back
Top