Accessing Data from Combo Box

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!! :(((
 
M

Marshall Barton

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top