asked on
ASKER
ASKER
Function setFilters()
Dim strFilter As String
Dim strTemp As String
Dim WordFilter As String
If Len(Me.Txt_Search_For) > 0 Then WordFilter = fnTextFilter(Me.Txt_Search_For, Wholewords, "[concatenated Description]")
'reset filter variable
strFilter = ""
'reset filter form property
Forms![FrmSMMTMaster].Form.Filter = strFilter
If Me.CBMarque & "" <> "" Then strFilter = strFilter & " and " & "[common marque]='" & Me.CBMarque & "'"
If Me.CBNom & "" <> "" Then strFilter = strFilter & " and " & "[Nom CC] Between " & Me.CBNom - Me.LblVNomCount.Caption & " AND " & Me.CBNom + Me.LblVNomCount.Caption
If Me.CBFuel & "" <> "" Then strFilter = strFilter & " and " & "[FUEL]='" & Me.CBFuel & "'"
If Me.CBTransmission & "" <> "" Then strFilter = strFilter & " and " & "[transmission]='" & Me.CBTransmission & "'"
If Me.CBBody & "" <> "" Then
Select Case Me.CBBody
Case "Coupe\Convertible"
strTemp = "Left([Body type],2)='CO'"
Case "Estate\MPV"
strTemp = "[Body type]='Estate' Or [body type]='MPV'"
Case "Hatchback", "Roadster", "Saloon"
strTemp = "[body type]='" & Me.CBBody & "'"
Case "Others"
strTemp = "[Body type] NOT IN('Estate', 'MPV', 'Hatchback', 'Saloon', 'Roadster')"
End Select
strFilter = strFilter & " and " & strTemp
End If
If Me.CBDoors & "" <> "" Then strFilter = strFilter & " and " & "[doors]=" & Me.CBDoors
If Len(WordFilter) > 0 And SmartFilterToggle = True Then strFilter = strFilter & " and " & WordFilter
If strFilter <> "" Then
strFilter = Mid(strFilter, 5) 'removes "and " at the beginning of strFilter
'Filter form
Debug.Print strFilter
Me.Filter = strFilter
Me.FilterOn = True
Else
Me.FilterOn = False
End If
End Function
You didn't have the category combobox in your code so I didn't add it either.Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.
TRUSTED BY
(Datatypes, Control Properties, will it always be the one OR, or can this be "Multiple" concatenations,...etc)
...and I am not quite sure why you are referencing the .text property of the combobox.
...and you also seem to be referencing other form controls besides the combobox...
"[Forms]![cw_client_matchi
A sample file would go a long way towards clearing these questions up:
Sample database notes:
1. Back up your database(s).
2. Combine the front and back ends into one database file.
3. Remove any startup options, unless they are relevant to the issue.
4. Remove any records unless they are relevant to the issue.
5. Delete any objects that do not relate directly to the issue.
6. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
7. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
8. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
9. Unhide any hidden database objects
10. Compile the code. (From the VBA code window, click: Debug-->Compile)
11. Run the compact/Repair utility.
12. Remove any Passwords and/or security.
13. If a form is involved in the issue, set the Modal and Popup properties to: No
(Again, unless these properties are associated with the issue)
14. Post the explicit steps to replicate the issue.
15. Test the database before posting.
In other words, ...post a database that we can easily open and immediately see and/or troubleshoot the issue.
And if applicable, also include a clear graphical representation of the *Exact* results you are expecting, based on the sample data.
JeffCoachman