Solved get data from selected listbox to textbox

Akai90

Member
Local time
Tomorrow, 02:32
Joined
Feb 8, 2022
Messages
67
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
 
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:
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

Back
Top Bottom