[AccessD] Process multi-select listbox

Rocky Smolin at Beach Access Software rockysmolin at bchacc.com
Mon Mar 5 11:03:38 CST 2007


No problem.  It's so rare that I can 1) offer an answer and 2) ring in
before the others (I feel like a Jeopardy contestant).

Rocky
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of artful at rogers.com
Sent: Monday, March 05, 2007 8:30 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Process multi-select listbox

Close, Rocky, but no cigar. I just figured it out, with your gentle prod in
the right direction. The solution is:

<code>
'---------------------------------------------------------------------------
------------
' Procedure : cmdProcess_Click
' DateTime  : 05/03/2007 11:24
' Author    : Arthur Fuller
' Purpose   : assemble column(0) multi-select choices from me.lstCities into
a string
' Notes     : This requires Option Base 0 for the array to be declared in
the Module Header.
'---------------------------------------------------------------------------
------------
'
Private Sub cmdProcess_Click()
    Dim intCount As Integer
    Dim varItem As Variant
    Dim s As String
    On Error GoTo cmdProcess_Click_Error
    intCount = 0
    With Me
        intCount = .lstCities.ItemsSelected.Count
        If intCount = 0 Then Exit Sub ' Nothing selected.
    
        For Each varItem In .lstCities.ItemsSelected
            s = s & .lstCities.ItemData(varItem)
        Next varItem
        .txtResult = s
    End With
    On Error GoTo 0
    Exit Sub
cmdProcess_Click_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
cmdProcess_Click of VBA Document Form_TestHarnessForTSPproblem_frm"
End Sub
</code>
 
Thanks for the prod,
Arthur 


----- Original Message ----
From: Rocky Smolin at Beach Access Software <rockysmolin at bchacc.com>
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Sent: Monday, March 5, 2007 10:11:25 AM
Subject: Re: [AccessD] Process multi-select listbox


Ooh. Ooh. I think I know this one.

    For Each varItem In lstOrders.ItemsSelected
        strList = strList & lstOrders.Column(0, varItem) & ";"
    Next varItem

Yes?

Rocky
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/710 - Release Date: 3/4/2007
1:58 PM
 




More information about the AccessD mailing list