Easy one: Display value of combo box

Christine Pearc

Christine
Local time
Today, 06:25
Joined
May 13, 2004
Messages
111
Could someone tell me the syntax for getting the value of column 2 from a combo box into a text field on a form?

My main table for storing date has a field called StatusID, which gets its value from tblStatus (SELECT tblStatus.StatusID, tblStatus.Status FROM tblStatus;). The StatusID is stored in tblCARs.

tblStatus has fields StatusID and Status (text description)

On the form, I simply want to get the Status (text description) for the StatusID stored in tblCARs - in a plain text control.

Should be easy, but I can't work it out!

Thank you,
Christine
 
Forms!formname!listboxname.Column(x,y)
where both x and y start at zero will get data from a list or combo box.

You can attach code to the OnChange event to update a textbox etc.
ListIndex is the value of the current column.

e.g. if you want to update a textbox with the data in column 2 of your combobox, the code for the OnChange event will be:

me!textboxname=me!listboxname.column(listindex,1)

Alternatively, rather than using listindex, you can use ItemsSelected.

Hope this helps.

Richard
 
Thank you for that, however perhaps I wasn't as clear as I should have been. You see, I need to get the value of column 2 of the field from the table, since the value doesn't appear on the form.

Thanks,
Christine
 
With the title of the thread being Easy one then I'm surprised you had to ask. I've never understood why people put easy one or quick one in the title of a thread as it can't be easy if they have to ask and if they don't know how it's done then they can't possibly know how much time is involved. :)

Anyway, rant over, have a look at my example here.
 

Users who are viewing this thread

Back
Top Bottom