The code below shows a query which will get me the row souce data for a combo box(level2) depending on the first combo box selection (level1). The code is simple if it to be used for one form. But I need to use it for so many forms, hence I would like to make function which can dynamically change the formname. When i substitute the "myform" with variable name the code always showing error
SELECT [Level2 data].L2_Name FROM [Level2 data] WHERE ((([Level2 data].L1_Name)=[Forms]![myform]![Level1]))
ORDER BY [Level2 data].L2_Name;
The question is direct, how to make the above code replacing myform with a variable. i use teh variabel like in other SQL code, but it don't work here.
SELECT [Level2 data].L2_Name FROM [Level2 data] WHERE ((([Level2 data].L1_Name)=[Forms]![myform]![Level1]))
ORDER BY [Level2 data].L2_Name;
The question is direct, how to make the above code replacing myform with a variable. i use teh variabel like in other SQL code, but it don't work here.