F
Fipp
I have a form titled "reportfilterfrm"
on this form I have 3 fields that I want my query to be based off of
[season] [team] [opponent]
[opponent] is a multi select list box. I wrote the following code and have a
textbox called [opponentselected] the code fills this box in with the names
of the opponents selected in the list box with a comma. Ex.
"opponentA,OpponentB"
Private Sub opponentscout_Click()
Dim varItem As Variant
Dim strList As String
Dim strSQL As String
With Me!cboopponent
If .MultiSelect = 0 Then
Me!opponentselected = .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.opponentselected = strList
End If
End Sub
Now I have the following sql for my query that binds it to the [season]
field and the [team] field on my form.
SELECT maingameformation.*, mainplay.*, maingameformation.season,
maingameformation.team, maingameformation.opponent
FROM maingameformation INNER JOIN mainplay ON maingameformation.playid =
mainplay.playid
WHERE (((maingameformation.season)=[forms]![reportfilterfrm]![cboseason])
AND ((maingameformation.team)=[forms]![reportfilterfrm]![cboteam]));
All of this works. I am now trying to bind the [opponentselected] field to
the query. I can't seem to make this work?
Any Suggestions?
on this form I have 3 fields that I want my query to be based off of
[season] [team] [opponent]
[opponent] is a multi select list box. I wrote the following code and have a
textbox called [opponentselected] the code fills this box in with the names
of the opponents selected in the list box with a comma. Ex.
"opponentA,OpponentB"
Private Sub opponentscout_Click()
Dim varItem As Variant
Dim strList As String
Dim strSQL As String
With Me!cboopponent
If .MultiSelect = 0 Then
Me!opponentselected = .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.opponentselected = strList
End If
End Sub
Now I have the following sql for my query that binds it to the [season]
field and the [team] field on my form.
SELECT maingameformation.*, mainplay.*, maingameformation.season,
maingameformation.team, maingameformation.opponent
FROM maingameformation INNER JOIN mainplay ON maingameformation.playid =
mainplay.playid
WHERE (((maingameformation.season)=[forms]![reportfilterfrm]![cboseason])
AND ((maingameformation.team)=[forms]![reportfilterfrm]![cboteam]));
All of this works. I am now trying to bind the [opponentselected] field to
the query. I can't seem to make this work?
Any Suggestions?