Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

multi list box filter

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fipp - 08 Jun 2007 03:54 GMT
I appreciate your help in advance. I am new to most of this and I need a
little assistance. I have searched the web and found some articles etc... I
am just not sure how to apply it to mine because I am unfamiliar with some of
the coding etc.. I understand a very little of what people are saying but I
can't quite put it all together.

I have a form called "reportfilterfrm" in this form I have 3 list box's. On
2 of the list box's multi select is selected to "None" and I have them bound
to the criteria field in my query and that works perfect. The 3rd list box
multi select is set to "Simple" and I am not sure how to get the query to
refrence this.

The query is called "reportfilterqry"

listbox #3 is called [opponent] I would like it to be the criteria for
[opponent] in the "reportfilterqry" It is a text field.

Thanks again for your help. I really appreciate it!
Arvin Meyer [MVP] - 08 Jun 2007 04:29 GMT
You need to put the results of your selections into a textbox (in this code
that would be txtSelected) and use that in SQL code with an IN clause:

Private Sub lstElevation_Click()

   Dim varItem As Variant
   Dim strList As String
   Dim strSQL As String

       With Me!lstElevation
           If .MultiSelect = 0 Then
               Me!txtSelected = .Value
           Else
               For Each varItem In .ItemsSelected
                   strList = strList & .Column(0, varItem) & ","
               Next varItem
               If strList <> "" Then
                   strList = Left$(strList, Len(strList) - 1)
               End If
               Me.txtSelected = strList
           End If

       End With

strSQL = "Select * From MyTable WHERE ID In (" & Me.txtSelected & ")"

End Sub

Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> I appreciate your help in advance. I am new to most of this and I need a
> little assistance. I have searched the web and found some articles etc...
[quoted text clipped - 19 lines]
>
> Thanks again for your help. I really appreciate it!
Fipp - 08 Jun 2007 19:31 GMT
Thanks for all your help. How do I get the results of my selection into the
textbox?
Arvin Meyer [MVP] - 12 Jun 2007 23:19 GMT
> Thanks for all your help. How do I get the results of my selection into
> the
> textbox?

This line of code in the snippet does it:

Me.txtSelected = strList

Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.