I have the following code:

***********************************
Dim sForm as string

If sForm = "A" then
A.ADOD1.Recordset = "SQLQuery"
end if

If sForm = "I" then
I.ADODC1.Recordset = "SQLQuery"
end if
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

The only difference between the two IF statements is the Form Name of either A or I at the begining of the .ADODC1 statement. I hope there is a way to eliminate the IF statements so that the code looks like the following:


***********************************
Dim s as string

s = "A" (or I may want it to be "I")

S.ADOD1.Recordset = "SQLQuery"

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


This way I can eliminate the if statements. How do I do it so that S represents the proper ADODC1 control on the proper form???


Thanks for any help