Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have combox look-up record?

Status
Not open for further replies.

Thijs

Technical User
Nov 24, 2000
31
NL
LS,

To begin bluntly, here is my problem:

I have a form with a subform on it. On this subform is a set of fields belonging to one table.
Furthermore there is this combobox which looks-up the last name" in the table (it is a table with a doctor name, address, etc)

How do I, when I select a name in the combo-box make the set of fields change to the correct record?

Thanks in advance,

Thijs Kromhout
The Netherlands.
 
Credit to "petrosky" in the Access General Discussion forum for the answer to this question. However, you will need to use an unbound combo box on your form and do the following:

Invoke the query builder for the rowsource of the Unbound combo. Add tblDoctors to the query builder then drag DoctorID (should be your primary key), DrFirstname, Drlastname into the builder.
Choose ascending under the Last name to make your searching easier if you like.

Now close the query builder.
Make your Column count 2 and your coloum widths 0,2.5"2.5"
Make your bound column 1

In the after update Event of your new combo put this code...

Private Sub Combo8_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[PatientID] = " & Me![Combo8]
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

'Replace Combo8 with your ComboName

Now when you select a name from the drop down your other info (i.e. proper record) should be visible.

Once again I give "petrosky" credit for this answer. It works for me. I have used hypothetical names obviously for your table and field names but by replacing those names in this situation with yours you should have no problem.

Good luck,

DAG
 
DAG,

I will certainly try this solution! Thnx to you and "petrosky". :)

Grts,

Thijs Kromhout
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top