Thanks eugin for your response.
As i have mentioned, i am using tempvars not in code(VBA) but in query design mode of access and i have given try with all the suggested method from your link.none seems to be working..
I am getting an error message : "syntax error in from clause" since the syntax has parentheses or exclamation mark which are not accepted.