Look up field in a form

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

Guest

I would like to have a field in my form where people can type in their ID
number (which is the primary key) and then their entire record comes up. Any
advice on how to do this would be greatly appreciated. thanks!
 
I would like to have a field in my form where people can type in their ID
number (which is the primary key) and then their entire record comes up. Any
advice on how to do this would be greatly appreciated. thanks!

Add a combo box to the form header using the Wizard. Select option 3,
something like 'Find a record ... etc.".
When completed, enter the ID in the combo box and it will find that
record.
 
I'm assuming you have the recordset/form for all your ID records open,
and from any ID record you want to jump to another.
Create an unbound combobox that displays all the legitimate IDs available
for search, and set the LimitToList = Yes.
On the AfterUpdate event of (ex. cboFindID combo name), do a FindRecord
to jump to the unique record associated with the ID selected.

Private Sub cboFindID_AfterUpdate()
DoCmd.GoToControl "ID"
DoCmd.FindRecord cboFindID
End Sub

On my web site under Access Tips (listed below), I have a sample 97 and
2003 file called "Quick Combo Find" that gives a simple example of using
this technique.
 
You have to create two forms: main form (master) and subform (child). The
subform would include the info of the whole record, and the main form would
include just the ID. Then you want to insert the subform within the main
form and connect them as Master and Child. In order to connect, you must
have the same key (identifier) in both forms. In your situation, the ID may
be the key. When you insert the subform, the wizard will go through the
steps for you.

I hope this helps.
 
Back
Top