S
Sreedhar
I've this procedure that attempts to filter a Report based on the values
chosen from a Multi-Select ListBox. But I'm unable to filter the Report
correctly if more than one value is chosen (Report is blanked out). Can
somebody please help me get this right ?
Thanks.
Private Sub cmdFilter_Click()
On Error GoTo Err_cmdFilter_Click
Dim i As Integer
Dim blnSelected As Boolean
Dim strSQL As String
blnSelected = False
For i = 0 To Me.lstBank.ListCount - 1
If Me.lstBank.Selected(i) Then
blnSelected = True
strSQL = strSQL & Me.lstBank.Column(0, i) & " OR "
End If
Next i
If blnSelected = False Then
MsgBox "Please select a row.", vbInformation, "Invalid Selection"
GoTo Exit_cmdFilter_Click
End If
strSQL = Left(strSQL, Len(strSQL) - 4)
Reports!rptCheque.Filter = "BankID = '" & strSQL & "'"
Reports!rptCheque.FilterOn = True
Exit_cmdFilter_Click:
Exit Sub
Err_cmdFilter_Click:
LogError "cmdFilter_Click - " & Me.Name, Err, Error
Resume Exit_cmdFilter_Click
End Sub
chosen from a Multi-Select ListBox. But I'm unable to filter the Report
correctly if more than one value is chosen (Report is blanked out). Can
somebody please help me get this right ?
Thanks.
Private Sub cmdFilter_Click()
On Error GoTo Err_cmdFilter_Click
Dim i As Integer
Dim blnSelected As Boolean
Dim strSQL As String
blnSelected = False
For i = 0 To Me.lstBank.ListCount - 1
If Me.lstBank.Selected(i) Then
blnSelected = True
strSQL = strSQL & Me.lstBank.Column(0, i) & " OR "
End If
Next i
If blnSelected = False Then
MsgBox "Please select a row.", vbInformation, "Invalid Selection"
GoTo Exit_cmdFilter_Click
End If
strSQL = Left(strSQL, Len(strSQL) - 4)
Reports!rptCheque.Filter = "BankID = '" & strSQL & "'"
Reports!rptCheque.FilterOn = True
Exit_cmdFilter_Click:
Exit Sub
Err_cmdFilter_Click:
LogError "cmdFilter_Click - " & Me.Name, Err, Error
Resume Exit_cmdFilter_Click
End Sub