Re: Having trouble with multi-select list box in Access

From: Paul Overway (paul_at_I.hate.spam.logico-solutions.com)
Date: 02/10/05


Date: Wed, 9 Feb 2005 22:29:06 -0500

Use function below by passing the name of the control...then assign the
return value to your field or text box.

Function GetItemsSelected(ctl As ListBox, IncludeQuotes As Boolean) As
Variant

Dim varThing As Variant

On Error Resume Next

    For Each varThing In ctl.ItemsSelected
        If IncludeQuotes Then
            GetItemsSelected = GetItemsSelected & Chr(39) &
ctl.ItemData(varThing) & Chr(39) & ","
        Else
            GetItemsSelected = GetItemsSelected & ctl.ItemData(varThing) &
","
        End If
    Next

    If Len(GetItemsSelected) > 0 Then
        GetItemsSelected = Left(GetItemsSelected, Len(GetItemsSelected) - 1)
    End If

End Function

-- 
Paul Overway
Logico Solutions
http://www.logico-solutions.com
"brandelfly" <brandelfly@discussions.microsoft.com> wrote in message 
news:B6022513-689E-49D4-9B64-5CE0320479A7@microsoft.com...
> I've set up a database and form in Access and have a multi-select list box
> (listing product types).  I want the field to include all selected 
> products
> in a list separated by commas but right now, after I select multiple
> products, the field is blank. 


Relevant Pages

  • Index liegt ausserhalb des.....
    ... In der frmMibs habe ich ein ListBox an die ich ein ArrayList gebunden ... private void cmdHerstellerDel_Click(object sender, System.EventArgs e) ... Der Index liegt außerhalb des ... newPosition, Boolean validating, Boolean endCurrentEdit, Boolean ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • ListBox and PostBackUrl event
    ... A page have a ListBox and I want that on the OnSelectedIndexChanged ... The problem is that the ListBox control does not have a PostBackUrl ... PostBackUrl event and could be used in this simple case but the number ... I needed to post it in instead of passing the pairs in a query ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Databinding a ListBox fires multiple SelectedIndexChanged events
    ... I've tried various approaches to resolving this - including your boolean ... > listbox, or just do removehandler and addhandler from those events what is ... >> SelectedIndexChanged event fires three times. ... >> Is this normal behaviour for the ListBox when using databinding? ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Check for Duplicate Appointment Times
    ... Have a look in the findstringexact for the listbox. ... Dim Time As Boolean ... MessageBox.Show("You already have an appointment at ... Public Function TimeTakenAs Boolean ...
    (microsoft.public.dotnet.languages.vb)
  • OT Re: SelectedIndexChanged event and the list view control.
    ... >> on the keydown of the listbox check the shift ... >> in your selectedindexchanged only do your code if the boolean is true ... >> keep in mind if you manually fill large listboxes and combos set the ...
    (microsoft.public.dotnet.languages.vb)

Quantcast