Link combo box and textbox (1 Viewer)

andy_25

Registered User.
Local time
Today, 05:22
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.
 

namliam

The Mailman - AWF VIP
Local time
Today, 06:22
Joined
Aug 11, 2003
Messages
11,695
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

Top Bottom