I have searched through and looked at several excellent threads regarding the use of Variables from VBA as queries. Using this knowledge I have created a function that returns a string and I have put that function into a Query and it works for simple results such as when a single character string such as "2" or "6" is returned.
However, sometimes the results of my code return multiple values such as 1,2 and 6 all of which I want to use as the Query criterea. If I enter this by hand in the criterea field using the format "1" or "2" or "6" it returns the result I want. However, when I set the function equal to "1" or "2" or "6" it doesn't work. I have also tried setting the function to be "'1' or '2' or '3'" and it still doesn't work. I even tried using the Include (1,2,6) format and that didn't work either.
Does anyone have any suggestions?
However, sometimes the results of my code return multiple values such as 1,2 and 6 all of which I want to use as the Query criterea. If I enter this by hand in the criterea field using the format "1" or "2" or "6" it returns the result I want. However, when I set the function equal to "1" or "2" or "6" it doesn't work. I have also tried setting the function to be "'1' or '2' or '3'" and it still doesn't work. I even tried using the Include (1,2,6) format and that didn't work either.
Does anyone have any suggestions?