If you instead of writing
prefer to write
then use this function
No error handling, I know, but it works fine for me.
Please feel free to comment and suggest improvements.
Code:
filter = "[Name]='" & someName & "' and [Category]='" & someCategory & "' or [Value]='" & someValue & "'"
Code:
filter = Printf("[Name]='%0' AND [Category]='%1' OR [Value]='%2'", someName, someCategory, someValue)
Code:
Function Printf(format As String, ParamArray args() As Variant) As String
Dim i As Integer
Dim ph As String
Printf = format
For i = LBound(args) To UBound(args)
ph = "%" & i
If InStr(1, format, ph) <> 0 Then
Printf = Replace(Printf, ph, args(i))
End If
Next
End Function
Please feel free to comment and suggest improvements.