Passing a TempVar to a Combo box form
Posted on 2016-10-18
In MS Access 2010 I am opening a single record form from another form with a button and passing a filter for the form with the button. That works fine. I also have a Combo box on the target form that I would like to populate with all the target forms filtered record set keys in order to allow the user to "jump" to the next record of choice rather than have to review the records sequentially.
So I am sending the Combo box query, select criteria as a TempVar. The Combo box query has a where clause, WHERE column IN ( [TempVars]![ComboFilterVariable] ). I pass this value, '("Active","On-Hold")' in one of the first forms SetTempVar to the target form.
When I replace the TempVar in the where clause with the value in TempVar which is ("Active","On-Hold"), assume the single quotes are removed by Access, the query works. But the query is not resolving the TempVar correctly as I get no rows using the TempVar in the query.
If I hard code the values the combo box it works. So not a combo box issue. I am using the same form with multiple filters so would really like to dynamically create the Combo box list to match the records provided by the filtered form rather than have multiple forms to display the same data for various lists.
Any help would be welcome, spent weeks on this on and off already.
I am a beginner at macros and novice at MS Access.