**Sorry, am now using Access 2013** will update my profile
So I want to set the control in a form I want to use in a statement like this:
if var1 = 1 then make var2 = control1
if var1 = 2 then make var2 = control2
The trouble is that when I do this, more specifically as:
Set ctrlCondChk = Forms("Template_Project").Controls("DESC_TemplateS tatus") 'for when var1 = 1
Set ctrlCondChk = Forms("Template_Project").Controls("ChkReason") 'for when var1 = 2
..the variable ctrlCondChk takes on the value that is in the control DESC_TemplateStatus!
However, I do not want the value, I want the field/control itself to be assigned the variable so I can use it later in my code..
ctrlCondChk will take on either DESC_TemplateStatus or ChkReason and then at that time, the value in one of these fields (depending on which is being activated by Var1) will be compared to a value..
So for the first iteration, I want to use a particular control/field and for the second iterative pass, I want to change the control/field that is referenced.
So, in summary then:
if var1 = 1 then make var2 = DESC_TemplateStatus
if var1 = 2 then make var2 = ChkReason
Then when iterating through another part of the code on say, iteration 1:
if var1 = "Active" then..do something 'for example, in this iterative loop wanting to see if DESC_TemplateStatus has the value "Active"
or if it is on iteration 2, then var1 should take on the 2nd control (not value, but the control itself..!)
If var1 = "Charge" then..do something..'for example, in this iterative loop, want to see if ChkReason has the value "Charge"
The reason is that the control being compared will change depending on the number of the iterative loop the code is currently on and instead of changing the control each time, I would rather set the change early in the code and then reference only one variable..
Thanks for any help!