<-- Previous || Up || Next -->

Strings To SQL Between Expression Function
String Extras Class

Public Function StringsToSQLBetweenExpression( _
      Optional ByVal vFrom As Variant _
    , Optional ByVal vThru As Variant _
    ) As String

Convert two values into a SQL WHERE expression that will locate a range of values.
The exact form of the expression depends upon which of vFrom and vThru are provided.

Examples:
    StringsToSQLBetweenExpression("A", "B") = "Between ""A"" And ""B"""
    StringsToSQLBetweenExpression(Null, "B") = "<= ""B"""
    StringsToSQLBetweenExpression("A", Null) = ">= ""A"""
    StringsToSQLBetweenExpression(Null, Null) = "Is Null"
    StringsToSQLBetweenExpression(12) = ">= ""12""" ' #5
See also:
    CharactersToSQLInExpression Function
    IsBetween Function
    IsWithinPlusOrMinusOf Function
    RangeComp Function
vFrom: String value representing the lower bound of the range of values to be located with the SQL WHERE expression. vFrom defaults to Null (which means that it is does not exist, i.e. there is no lower bound) if it is missing or Null or cannot be fixed up to a String.

vThru: String value representing the upper bound of the range of values to be located with the SQL WHERE expression. vThru defaults to Null (which means that it is does not exist, i.e. there is no upper bound) if it is missing or Null or cannot be fixed up to a String.

Note: This function only works with vFrom and vThru values that are strings. If either of these arguments if numeric, they will be fixed up to a String as in example #5.
Note: Embedded double quote characters within either vFrom or vThru will be prefixed by an additional double-quote character so that Microsoft's SQL will not interpret them as the double-quote which ends the string literal.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.