I have a 'very' long query written through MS Access with lot of unions (around 30) and other dynamic variables.

Now, I need to insert a 'Where' clause in all those unions, and the where clause would be constant and generated through a form (selecting some options, I have written a vb code to create a string containing the where clause.

Is there any way I could use some variables in the SQL query so that the variable gets the where clause from the text result of the form action?

Illustrative: My Query

Please Login or Register  to view this content.
The should be populated with the text box result which would look something like 'where b=1'

I thought of writing it in the VB code itself, but to numerous linebreaks and chaning nature of the queries, I do not want to manually keep adding " & _ at the end of each line.

Any help would be greatly appreciated.

Regards, Navs