by value by reference (a basic programming question)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top