list box to text box

cos

Registered User.
Local time
Today, 08:15
Joined
Jul 13, 2012
Messages
81
how can i show a selected by the user record from a list box in an unbound text box? i made a listbox which has two columns and shows various info, and i need the selected record, what appears to be in column two to be shown in my text box..

any ideas?
 
Try using this..
Code:
Me.[COLOR=Blue]unboundTextBoxName[/COLOR] = Me.[COLOR=Blue]ListBoxName[/COLOR].Column(1, Me.[COLOR=Blue]ListBoxName[/COLOR].ItemsSelected)
Blue bits needs to change, as it is in the Second column and List box are 0 based so you use 1 to reference 2nd column.
 
Something like this. Select the list box in design view and open the properties then click the Event tab and use the On Click Event

Private Sub List0_Click()
Me.txtName.Value = Me.List0.Column(1)

End Sub
 
i have no idea where to put that code.. as i tried and nothin works.. =/
 
Read my instructions and you will be able to do what you want.

Open the form in design view and select the ListBox Open the properties and then the Event Tab, and then the On Click Event and use the Ellipse button and select Code Builder then you add the code inside there.
 
and for yours Trevor, i get this error:

"The expression On Click you entered as the event property setting produced the following error: Invalid outside procedure."
 
OK Copy what code you have added and also list the 2 named objects, i.e what have you called the listbox and the textbox.
 
haha.. its working now!! thx a lot Trevor! and Pr2!
 
Pleased to read you have a working solution and thanks for letting us know.
 
however.. quick question.. how can i filter a subform from this value now? :S
 

Users who are viewing this thread

Back
Top Bottom