Accessing Data from Combo Box

  • Thread starter Thread starter ABZ123
  • Start date Start date
A

ABZ123

Hi,


I need some help here ..


I have the following relationsships and the correspoding tables.


Patients -< Orders -< OrderDetails >- Products
v v
| |
Practices --------------< Doctors


tblOrders (OrderID, PatientID)


1. I have created an Order Form and I can now select a Patient from the

Combo Box (PatientID). I have also created extra Text boxes for the
relevant field (Address, Tel etc). How do I populate these text boxes
from the Combo Selection. I understand that I have to code he "after
update" event with something like Me.Text5 = Me.PatientID.Column(4).
However the combo box refers to the Orders table which has OderID
(Automatically generated) and PatientID. I need to use the PatientID
and access the tblPatientDetails to get the data I require. Help, i'm
stuck!! :(((
 
ABZ123 said:
I have the following relationsships and the correspoding tables.

Patients -< Orders -< OrderDetails >- Products
v v
| |
Practices --------------< Doctors

tblOrders (OrderID, PatientID)

1. I have created an Order Form and I can now select a Patient from the

Combo Box (PatientID). I have also created extra Text boxes for the
relevant field (Address, Tel etc). How do I populate these text boxes
from the Combo Selection. I understand that I have to code he "after
update" event with something like Me.Text5 = Me.PatientID.Column(4).
However the combo box refers to the Orders table which has OderID
(Automatically generated) and PatientID. I need to use the PatientID
and access the tblPatientDetails to get the data I require.


The patient combo box's RowSource should be a query based on
the Patients table and include the needed fields. The combo
box's BoundColumn would be the PatientID field with the
patient's name the first visible column (ColumnWidths
property). The other fields (address, etc) may or may not
be displayed in the dropdown as you decide.

With all that working properly, you can display the other
fields without using any code. Just set the address text
box's control source expression to something like"
=PatientID.Column(4)
 
Back
Top