G
Guest
I have a query where I generate a list of names if a two-digit year for a
year 2 years ago is found in a string in a text field. In the QBE grid, I use
the following criteria: Like "*" & "03" & "*". Works like a charm. But,
next year the criteria would be: Like "*" & "04" & "*".
I now want to generalize the query to avoid having to open up the query and
change the date. First try was: CStr(Right((Date-730),2)) as a replacement
for 03. Entire criteria was: Like "*" & CStr(Right((Date-730),2)) & "*".
Another try was: "*" & "CStr(Right((Date-730,2))" & "*". Records should have
been returned but were not in either case. Placed ?CStr(Right((Date-730),2))
in the Immediate Window and it returned the desired 03. Thus I must be using
quotes and asterisks incorrectly.
Your suggestions on the correct criteria would be greatly appreciated.
year 2 years ago is found in a string in a text field. In the QBE grid, I use
the following criteria: Like "*" & "03" & "*". Works like a charm. But,
next year the criteria would be: Like "*" & "04" & "*".
I now want to generalize the query to avoid having to open up the query and
change the date. First try was: CStr(Right((Date-730),2)) as a replacement
for 03. Entire criteria was: Like "*" & CStr(Right((Date-730),2)) & "*".
Another try was: "*" & "CStr(Right((Date-730,2))" & "*". Records should have
been returned but were not in either case. Placed ?CStr(Right((Date-730),2))
in the Immediate Window and it returned the desired 03. Thus I must be using
quotes and asterisks incorrectly.
Your suggestions on the correct criteria would be greatly appreciated.