Creating a Controll through code.

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

Guest

Hi I have a function that returns the name of a controll (as a string) whos
data is invalid. In the calling method can anyone tell me how to take the
return value of the function(string from ctl.name) and use it to set focus to
the controll without using a case statment.

Thanks in advance.

James.
 
You will also need to know which form this control is on.

Assuming it is the current form, and MyFunc() returns the name of the
control, you could do it like this:

Dim strCtlName As String
strCtlName = MyFunc()
Me(strCtlName).SetFocus
 
hi James,
Hi I have a function that returns the name of a controll (as a string) whos
data is invalid. In the calling method can anyone tell me how to take the
return value of the function(string from ctl.name) and use it to set focus to
the controll without using a case statment.
Me.Controls("Name").SetFocus should work.


mfG
--> stefan <--
 
Ha Ha, that was so simple I am still laughing at myself.

Thanks as usuall for your help Allen.
 
Back
Top