Code:
Dim iFirst as integer,boIsFirst as Boolean
[strSQL = "SELECT ID FROM tbl_Albums WHERE tbl_Albums.GenreLink = "
'Check for a Genre or Genres selection
If Me.lstGenre.ItemsSelected.Count > 0 Then
blnGenreSelected = True
iFirst =0
boIsFirst =False
'Loop through the selected items to build an SQL WHERE Clause
With Me.lstGenre
For i = 0 To .ListCount - 1
If .Selected(i) Then
if iFirst =0 Then boIsFirst =True 'set the flag to True for the first record
If boIsFirst =True Then '------------- Need to identify that this is the first selected item
strSQL = strSQL & .Column(0, i) ------------ So only the value gets added to the SQL
Else
strSQL = strSQL & " OR tbl_Albums.GenreLink = " & .Column(0, i) ------- Whereas, here need to Add the 'OR Clause and the value
End If
End If
iFirst=i
boIsFirst =False 'reset the flag
Next i
End With
End If
You're right Paul, it would have treated all as the first record, I think this revision would work if the OP wants to go this route.
Cheers,