Link combo box and textbox

andy_25

Registered User.
Local time
Today, 18:59
Joined
Jan 27, 2009
Messages
86
Hi,

I have a simple database which has a combobox with the following query:

SELECT PUPILS.[Pupil Name], PUPILS.Form FROM PUPILS;

It's a simple query which has 2 fields. I need the user to be able to select a pupil from the combobox and display their form in a textbox. I have tried several ways but cannot seem to get it to work, for some reason I cannot get them to link.

Any ideas? Thanks.
 
for one thing, form is a reserved word and shouldnt be used as a column name.
Another thing Naming convention, tables have a tbl prefix, frm, qry, mdl etc. And no object/column name will have a space in it.

You can do this by using the "on change" event.
Then use the columns property of the combobox to "extract" out the "form" column
Me.YourTextbox = Me.Yourcombo.columns(1)

1 is because the columns property is a 0 based array, making 1 actually the second column with 0 beeing the first.
 

Users who are viewing this thread

Back
Top Bottom