Howdy, Stranger!

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

Categories

Multiselect listbox - Access 97

jim clarkjim clark Member Posts: 5
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

  • SagaciousSagacious Member Posts: 36
    : 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
  • Justin BibJustin Bib USAMember Posts: 0

    ________ [ http://forcoder.org ] free ebooks and video tutorials about \ Ruby, Delphi, Swift, C++, C, Visual Basic .NET, Python, Assembly, Visual Basic, Go, C#, Scratch, Perl, JavaScript, Java, PL/SQL, Objective-C, MATLAB, PHP, R F#, Clojure, Apex, Scala, Hack, Erlang, D, ABAP, Bash, Fortran, LabVIEW, Crystal, SAS, Dart, Logo, Alice, Lisp, Prolog, Awk, Rust, VBScript, COBOL, Lua, ML, FoxPro, Ada, Transact-SQL, Julia, Scheme, Kotlin \ ___

Sign In or Register to comment.