Solved get data from selected listbox to textbox (1 Viewer)

Akai90

Member
Local time
Today, 07:13
Joined
Feb 8, 2022
Messages
65
I am trying to make a textbox get data from selected listbox from query.

listbox bound with 4 column & 4 textbox

when selected listbox data it will update the textbox data

hope you understand
 

June7

AWF VIP
Local time
Yesterday, 15:13
Joined
Mar 9, 2014
Messages
5,488
Expression in textbox can reference combobox or listbox column by index. Index begins with 0. If value is in 2nd column its index is 1.

=[comboboxname].Column(1)

This will also work for a single-select listbox. If listbox is multi-select, VBA is required.

This will not save to table field. Saving will require code (macro or VBA). Saving this duplicates data between tables and usually is not appropriate.
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:13
Joined
May 7, 2009
Messages
19,246
Code:
Dim var As Variant
Dim content As String
For Each var In Me!Listbox1.ItemsSelected
    content = content & "," & Me!listbox1(var, 0)
Next
If Len(content) <> 0 Then
    Me!textbox1 = content
End If
 

Users who are viewing this thread

Top Bottom