by value by reference (a basic programming question)

K

krcmd1

I am getting a runtime error that an object (actually a control on a form)
can't be found. What I don't understand is that the error message specifies
the object using the string variable that I am using in the problem
statement, rather than saying that it can't find the control named by the
string. If the string variable contains the name of the control, can't I use
the string variable in the reference?

i.e. forms!formname!stringvariable

I have tried this with and without quotation marks and with and without
brackets around stringvariable.

Thank you
 
B

Brendan Reynolds

Forms!FormName.Controls(stringvariable)

.... should work.

As the Controls collection is the default property of the Form object, you
can shorten the above to ...

Forms!FormName(stringvariable)

.... if you want to.
 
Top