How to pass a variable to filter statement

MilaK

Registered User.
Local time
Yesterday, 23:57
Joined
Feb 9, 2015
Messages
285
Hello,

I'm using the following loop to filter multiple subforms on a Main_form:

Code:
strform = "frm_subform"

For j = 0 To 2
        Debug.Print sample_array(j)
        y = j + 1
        c = CStr(y)
        Debug.Print c

        numbered_form = strform & c    'corresponds to the name of each subform that will contain a different number extension for each loop iteration
       
        Criteria = "[sample_name] = '" & sample_array(j) & "' AND [run_name] = '" & Run_Name & "'"
Debug.Print Criteria
       
        Forms!Main_form.[B]numbered_form[/B].Form.Filter = Criteria
        Forms!Main_form.[B]numbered_form[/B].Form.FilterOn = True
    Next j

I would like to pass a string variable that contains the name of the subform to the Criteria statement, since it will be different each loop iteration.

How do I incorporate string variable into Filter criteria statement? Thanks, Mila
 

Users who are viewing this thread

Back
Top Bottom