H
Howard
The field in my table that I use to search contains strings such as
Y_10_S01, Y_11_S01 or Y_11_S02 that have a natural alphabetical order.
If I use either Between "Y_10_S01" and "Y_11_S01" (with double quotes) or
Between 'Y_10_S01' and 'Y_11_S01' (single quotes) directly into the query it
works fine.
However if I first store the critera in a string variable inside a module
e.g.
MyCriteria = "Between 'Y_10_S01' and 'Y_11_S01'" (single quotes encloed
withing double) and
and a function
Function GetCriteria() as string
GetCriteria = MyCriteria
End function
is called in the query criteria instead, the query returns nothing.
A debug msgbox is showing the function to be correctly returning Between
'Y_10_S01' and 'Y_11_S01'
What am I doing wrong?
Howard
Y_10_S01, Y_11_S01 or Y_11_S02 that have a natural alphabetical order.
If I use either Between "Y_10_S01" and "Y_11_S01" (with double quotes) or
Between 'Y_10_S01' and 'Y_11_S01' (single quotes) directly into the query it
works fine.
However if I first store the critera in a string variable inside a module
e.g.
MyCriteria = "Between 'Y_10_S01' and 'Y_11_S01'" (single quotes encloed
withing double) and
and a function
Function GetCriteria() as string
GetCriteria = MyCriteria
End function
is called in the query criteria instead, the query returns nothing.
A debug msgbox is showing the function to be correctly returning Between
'Y_10_S01' and 'Y_11_S01'
What am I doing wrong?
Howard