@@ -319,7 +319,7 @@ Public Function BuildCriteria(ByVal FieldName As String, ByVal FieldDataType As
319319   'Special cases (part 2): 
320320   If  Not  IsArray(FilterValue) Then 
321321
322-       If  FieldDataType = SQL_Numeric Then 
322+       If  FieldDataType = SQL_Numeric Or  FieldDataType = SQL_Date  Then 
323323
324324         If  FilterValue = "*"  And  RelationalOperator = SQL_Equal Then 
325325            BuildCriteria = BuildCriteria(FieldName, FieldDataType, SQL_Not, Null , Null , 0 , True )
@@ -354,7 +354,7 @@ Public Function BuildCriteria(ByVal FieldName As String, ByVal FieldDataType As
354354      Exit Function 
355355   End If 
356356
357-    If  (RelationalOperator And  SQL_Like) = SQL_Like Then 
357+    If  (RelationalOperator And  SQL_Like) = SQL_Like Or  (RelationalOperator  And  SQL_UseLikeBehavior) = SQL_UseLikeBehavior  Then 
358358      If  SqlWildCardString <> "*"  Then 
359359         If  InStr(1 , FilterValue, "*" ) > 0  Then 
360360            FilterValue = Replace(FilterValue, "[*]" , "@@@|||STAR|||@@@" )
@@ -372,7 +372,7 @@ Public Function BuildCriteria(ByVal FieldName As String, ByVal FieldDataType As
372372   End If 
373373
374374   If  (RelationalOperator And  SQL_Add_WildCardPrefix) = SQL_Add_WildCardPrefix Then 
375-       If  (RelationalOperator And  SQL_Like) = SQL_Like Then 
375+       If  (RelationalOperator And  SQL_Like) = SQL_Like Or  (RelationalOperator  And  SQL_UseLikeBehavior) = SQL_UseLikeBehavior  Then 
376376         FilterValue = SqlWildCardString & FilterValue
377377      End If 
378378   End If 
@@ -798,9 +798,9 @@ Private Function TryBuildWildCardSuffixOrPreBuildParams(ByVal FieldName As Strin
798798   Dim  Criteria1 As  String 
799799   Dim  Criteria2 As  String 
800800
801-    If  (RelationalOperator And  SQL_Like) = SQL_Like Then 
801+    If  (RelationalOperator And  SQL_Like) = SQL_Like Or  (RelationalOperator  And  SQL_UseLikeBehavior) = SQL_UseLikeBehavior  Then 
802802      FilterValue = FilterValue & SqlWildCardString
803-    ElseIf  ( FieldDataType  And  SQL_Date)  = SQL_Date Then 
803+    ElseIf  FieldDataType = SQL_Date Then 
804804      If  (RelationalOperator And  SQL_LessThan) = 0  Then  ' no < therefore:  >, >= or only = 
805805         If  (RelationalOperator And  SQL_GreaterThan) = SQL_GreaterThan Then 
806806            ' change nothing ... >= DataValue  / SQL_Add_WildCardSuffix is not logical 
@@ -817,7 +817,7 @@ Private Function TryBuildWildCardSuffixOrPreBuildParams(ByVal FieldName As Strin
817817         End If 
818818         FilterValue = DateAdd("d" , 1 , CDate(CLng(FilterValue)))
819819      End If 
820-    ElseIf  ( FieldDataType  And  SQL_Numeric)  = SQL_Numeric Then 
820+    ElseIf  FieldDataType = SQL_Numeric Then 
821821      If  (RelationalOperator And  SQL_LessThan) = 0  Then  ' no < daher:  >, >= or only = 
822822         If  (RelationalOperator And  SQL_GreaterThan) = SQL_GreaterThan Then 
823823            If  FilterValue Like  "*[,.]*[*]"  Then 
@@ -865,8 +865,10 @@ Private Function TryBuildNumericSpecialCasesCriteria(ByRef FieldName As String,
865865
866866   Const  FilterValue2 As  Variant  = Null 
867867
868-    FilterValue = Trim(FilterValue)
869-             
868+    If  VarType(FilterValue) = vbString Then 
869+       FilterValue = Trim(FilterValue)
870+    End If 
871+    
870872   If  FilterValue Like  "[0-9]*..*[0-9]*"  Or  FilterValue Like  "[+-][0-9]*..*[0-9]*"  Then 
871873      TempArr = Split(FilterValue, ".." )
872874      Criteria = BuildCriteria(FieldName, FieldDataType, SQL_Between, Trim(TempArr(0 )), Trim(TempArr(1 )), IgnoreValue, DisableIgnoreNullValue)
0 commit comments