Question Paste into textbox based on value(s) selected from a list (1 Viewer)

greg@gambit.net

New member
Local time
Yesterday, 19:47
Joined
Oct 23, 2016
Messages
2
I have a table [FormBody] with 3 fields. [ID] [Title] [Body

I want a listbox on my form that is based on the FormBody showing the [title]

When multiple items are selected in the list box, I want to be able to click a paste button that will paste the [Body] data into a unbound text box with blank lines separating each.

I know this may be asking a lot! I have messed with this for a while and at this point I not this can even be done. Any help would be greatly appreciated.
 

moke123

AWF VIP
Local time
Today, 01:47
Joined
Jan 11, 2013
Messages
3,852
you would need something like this. substitute the name of your listbox and the name of your textbox. you may also need to change the column number.


Code:
Dim str As String

 Dim lngRow As Long


    With Me.List0
        For lngRow = 0 To .ListCount - 1
            If .Selected(lngRow) Then
                str = str & .Column(2, lngRow) & vbNewLine
            End If
        Next lngRow
    End With
   
    
Me.Text2 = str
 

greg@gambit.net

New member
Local time
Yesterday, 19:47
Joined
Oct 23, 2016
Messages
2
MOKE123, Thank you very much. I guess I was trying to make it too complicated. Worked like a charm!
 

Users who are viewing this thread

Top Bottom