Creating a Controll through code.

J

James D.

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

Allen Browne

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
 
S

Stefan Hoffmann

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

James D.

Ha Ha, that was so simple I am still laughing at myself.

Thanks as usuall for your help Allen.
 

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

Top