Multiselect listbox - Access 97

I need some help please!
I'm working in access 97, and I have a multiselect textbox with the "simple" option selected. I am not proficient with code, but I have the code below, that partially works.

Dim i As Integer

For i = List0.ListCount - 1 To 0 Step -1
If Me.List0.Selected(i) = True Then
Let Me.Text2 = Me.List0.ItemData(i)
End If
Next i

This fills a textbox on my form (text2) with the first selection made in a multiselect listbox (list0).
How do I fill the second text box on the form with the next selection made, and the third text box, etc.
Any help will be greatly appreciated. I need to fill up to 10 textboxes on the same form as the listbox is located.

Thanks for any help you can give - in advance.

Jim Clark

Comments

  • : I need some help please!
    : I'm working in access 97, and I have a multiselect textbox with the "simple" option selected. I am not proficient with code, but I have the code below, that partially works.
    :
    : Dim i As Integer
    :
    : For i = List0.ListCount - 1 To 0 Step -1
    : If Me.List0.Selected(i) = True Then
    : Let Me.Text2 = Me.List0.ItemData(i)
    : End If
    : Next i
    :
    : This fills a textbox on my form (text2) with the first selection made in a multiselect listbox (list0).
    : How do I fill the second text box on the form with the next selection made, and the third text box, etc.
    : Any help will be greatly appreciated. I need to fill up to 10 textboxes on the same form as the listbox is located.
    :
    : Thanks for any help you can give - in advance.
    :
    : Jim Clark
    :
    :

    Jim,

    I am kind of currious how you might find this useful. Anyway, there are many ways to do what you need. This just happens to be the one I thought of first.

    [Code]
    Private Sub List1_Click()
    On Error Resume Next
    Dim ctl As Control
    Dim NewValue As String

    NewValue = List1.Value

    For Each ctl In Controls
    If ctl.ControlType = acTextBox Then
    With ctl
    .SetFocus
    If .Text = "" Then
    .Text = List1.Value
    Exit For
    End If
    End With
    End If
    Next ctl

    End Sub
    [/Code]

    Hope this helps,
    Sagacious
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion