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