Pulling attributes from ComboListBox selection

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

Guest

Hello. I have a basic Access form in which I have a ComboListBox that
displays a persons name in "LastName, FirstName" format from a table called
Patients.

What I want to be able to do is pull 3 other attributes from the record
associated with the name chosen in the ComboListBox and populate 3 seperate
text boxes on the same form.

Is there a way to use this without having to set-up a DAO, ADO, etc..
recordset?

I haven't tried to do something like this in a few years, so I'm drawing a
total blank.

Thanx.
Andy
 
hi,
What I want to be able to do is pull 3 other attributes from the record
associated with the name chosen in the ComboListBox and populate 3 seperate
text boxes on the same form.
Is there a way to use this without having to set-up a DAO, ADO, etc..
recordset?
Use the ComboBoix property .Column(Index). It will return the column
data from the RowSource directly, even when the column width is 0.

So, if you set your ComboBox RowSource to "SELECT ID, FirstName,
LastName FROM Table", then Column(1) will give you the FirstName of the
choosen record.
I haven't tried to do something like this in a few years, so I'm drawing a
total blank.
A C programmer told me once: Know your classes :)


mfG
--> stefan <--
 
Hello. I have a basic Access form in which I have a ComboListBox that
displays a persons name in "LastName, FirstName" format from a table called
Patients.

What I want to be able to do is pull 3 other attributes from the record
associated with the name chosen in the ComboListBox and populate 3 seperate
text boxes on the same form.

Is there a way to use this without having to set-up a DAO, ADO, etc..
recordset?

I haven't tried to do something like this in a few years, so I'm drawing a
total blank.

Well, you should certainly NOT be *STORING* the looked-up values (or
even the last and first names) in your form's table. That would be
redundant; all that should be stored in this second table is the
unique person ID.

To *display* other fields from the combo, use unbound textboxes on the
form with control sources like

=comboboxname.Column(n)

where n is the zero based index of the field - that is, if the combo
cboPerson has five columns and the fifth is the phone number, use

=cboPerson.Column(4)


John W. Vinson[MVP]
 
Back
Top