I use a query called ClientQRY with a field called “MetroAreaCode” which needs a value of 1 thru 10 to filter geographic regions. I use this query in my forms. I open my forms with a switch board form currently with different control buttons to open identical second forms with different versions of “ClientQry” each with a different MetroAreaCode value for the filter. But instead of having many forms for each region (which I have to change all of them when I make a minor program change) I want to simplify this by using only one second form with one ClientQRY but to set a public variable in the first switchboard form to the value of 1 thru 10 to filter the query used in my second form.
I have created the public variables called “varAreaCode” in the module:
“Public varAreaCode As Variant”
And set varAreaCode=4 in the control button code when opening the second form that uses the MetroAreaCode
I then tried to change the filter in the query by changing
WHERE (((APTS.MetroAreaCode)=4))
To:
WHERE (((APTS.MetroAreaCode)="varAreaCode"))
However, this does not work.
What am I doing wrong?
Thanks
I have created the public variables called “varAreaCode” in the module:
“Public varAreaCode As Variant”
And set varAreaCode=4 in the control button code when opening the second form that uses the MetroAreaCode
I then tried to change the filter in the query by changing
WHERE (((APTS.MetroAreaCode)=4))
To:
WHERE (((APTS.MetroAreaCode)="varAreaCode"))
However, this does not work.
What am I doing wrong?
Thanks