Trevor G
Registered User.
- Local time
- Today, 14:52
- Joined
- Oct 1, 2009
- Messages
- 2,368
I have a search form which has a number of combo boxes which will allow me to filter. There is an issue with the filtered function.
If I select one of the combos and select (BUG Field Name) and filter from the combo I get the following results
CAR = 452 (In the table there are 500)
International = 15535 (In the table there are 16139)
Professional Indemnity = 33828 (In the table there are 34243)
UK and Ireland = 56140 (In the table there are 56739)
The combo Record source is the same as the table, but grouped together and the SQL view is as follows:
The code that is behind the Command Button is as follows:
If I select one of the combos and select (BUG Field Name) and filter from the combo I get the following results
CAR = 452 (In the table there are 500)
International = 15535 (In the table there are 16139)
Professional Indemnity = 33828 (In the table there are 34243)
UK and Ireland = 56140 (In the table there are 56739)
The combo Record source is the same as the table, but grouped together and the SQL view is as follows:
SELECT Combined.BUG
FROM Combined
GROUP BY Combined.BUG;
The code that is behind the Command Button is as follows:
Dim strUWYear As String
Dim strBUG As String
Dim strTerritory As String
Dim strPortFolio As String
Dim strPolicyRef As String
Dim strInsuredName As String
Dim strTrade As String
Dim strUnderWriter As String
If IsNull(Me.cboUWYear.Value) Then
strUWYear = "Like '*'"
Else
strUWYear = "='" & Me.cboUWYear.Value & "'"
End If
If IsNull(Me.cboBUG.Value) Then
strBUG = "Like '*'"
Else
strBUG = "='" & Me.cboBUG.Value & "'"
End If
If IsNull(Me.cboTerritoryName.Value) Then
strTerritory = "Like '*'"
Else
strTerritory = "='" & Me.cboTerritoryName.Value & "'"
End If
If IsNull(Me.cboPortFolio.Value) Then
strPortFolio = "Like '*'"
Else
strPortFolio = "='" & Me.cboPortFolio.Value & "'"
End If
If IsNull(Me.cboPolicyNumber.Value) Then
strPolicyRef = "Like '*'"
Else
strPolicyRef = "='" & Me.cboPolicyNumber.Value & "'"
End If
If IsNull(Me.cboInsuredName.Value) Then
strInsuredName = "Like '*'"
Else
strInsuredName = "='" & Me.cboInsuredName.Value & "'"
End If
If IsNull(Me.cboTrade.Value) Then
strTrade = "Like '*'"
Else
strTrade = "='" & Me.cboTrade.Value & "'"
End If
If IsNull(Me.cboUnderWriter.Value) Then
strUnderWriter = "Like '*'"
Else
strUnderWriter = "='" & Me.cboUnderWriter.Value & "'"
End If
Me.frmCombinedSearchEngineFilter.Form.Filter = "[UWYear]" & strUWYear & " AND [BUG]" & strBUG & " AND [Location1]" & strTerritory & " AND [Reporting Class 2]" & strPortFolio _
& " AND [Policy Ref]" & strPolicyRef & " AND [INSURED NAME]" & strInsuredName & " AND [Trade]" & strTrade & " AND [UWR]" & strUnderWriter
Me.frmCombinedSearchEngineFilter.Form.FilterOn = True