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 / January 2008

Tip: Looking for answers? Try searching our database.

query based on multiselctbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
david - 29 Jan 2008 15:49 GMT
Hi, i want to make an query based on a multiselctboxin a form. i have the
following code:

   Dim db As DAO.Database
   Dim qdf As DAO.QueryDef
   Dim varItem As Variant
   Dim strCriteria As String
   Dim strSQL As String
   
   Set db = CurrentDb()
   Set qdf = db.QueryDefs("qryMultiselect")
   
   If Me!lstSagsnummer.ItemsSelected.Count > 0 Then
       For Each varItem In Me!lstSagsnummer.ItemsSelected
           strCriteria = strCriteria & "Sager_HT.Sagsnummer = " & Chr(34) _
                         & Me!lstSagsnummer.ItemData(varItem) & Chr(34) &
"OR "
       Next varItem
       strCriteria = Left(strCriteria, Len(strCriteria) - 3)
   Else
       strCriteria = "Sager_HT.Sagsnummer Like '*'"
   End If
   
   
   strSQL = "SELECT * FROM Sager_HT " & _
            "WHERE " & strCriteria & ";"
   qdf.SQL = strSQL

But, i want to take some data from another table. hope anyone can help me.
Thanks
excel/access-chump - 31 Jan 2008 20:18 GMT
Could you tell us what other table?
What are the fields you are looking to incorporate into this query?
Signature


-The Chump - Jason

> Hi, i want to make an query based on a multiselctboxin a form. i have the
> following code:
[quoted text clipped - 26 lines]
> But, i want to take some data from another table. hope anyone can help me.
> Thanks
 
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.