Control name is a variable

  • Thread starter Thread starter DavPet
  • Start date Start date
D

DavPet

I have a control name from my form in a variable called MyControl.
How can I use the variable in code to set properties like:
when MyControl is equal to "Form_frmSSPI_LOGON.txtUserID"
I want to say

MyControl.backcolor = vbRed

but it doesn't work.
 
DavPet said:
I have a control name from my form in a variable called MyControl.
How can I use the variable in code to set properties like:
when MyControl is equal to "Form_frmSSPI_LOGON.txtUserID"
I want to say

MyControl.backcolor = vbRed

but it doesn't work.

MyControl = "txtUserID"
Me(MyControl).BackColor = vbRed
 

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