List Box SOS

J

Julius

I have a list box on an unbound form, I am trying to extract data from a
query based on the selection I make in the list box, however nothing happens.
I put the form name in the query so that the unbound date field will work,
however I can not get the data to come to view. What am I doing wrong.
 
M

M Skabialka

Are you using the data selected?
e.g. the first item in the list for my listbox DateSelect contains data
extracted like this:

Me!DateSelect.ItemData(0)

Also look for info about .ItemsSelected which tells which rows were selected
and MultiSelect property for multiple choices, etc
 
J

Julius

Thank you for your quick response it is greatly appreciated. I got it to
work I used [Forms]![frmMassOverflowForm]![List72] as a criteria in the
CallCenterID field. The biggest headache I am having is that it works fine
if I want to select on list item at a time. However I also need to select
multiple CallCenterIDs in my list box. I changed the Multi Select to Simple
or Extended, when I do this no results are returned. It only works for none.
I have visited several website for additional help, but to no avail I have
an even bigger headache, I am totally not good with code and where it goes,
can you help me to make this a multi select list box using the simplest
method as possible.
 
J

Julius

I went on line and they said to use the following:

Dim Criteria As String
Dim i As Variant

' Build criteria string from selected items in list box.
Criteria = ""
For Each i In Me![List72].ItemsSelected
If Criteria <> "" Then
Criteria = Criteria & " OR "
End If
Criteria = Criteria & "[CallCenterID]='" _
& Me![List72].ItemData(i) & "'"
Next i

' Filter the form using selected items in the list box.
Me.Filter = Criteria
Me.FilterOn = True

End Sub

I did the name CallCenterID is an actual name. I am using the listbox to
generate reports this does not seem like it can help me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top