coverting sub into more useful Function

  • Thread starter Thread starter Question Boy
  • Start date Start date
Q

Question Boy

I have a sub that uses code like:

With Me.EmailAdd1
....


I am trying to switch the sub into a function that I could use from multiple
forms....,but am experiencing some difficulties.

I would like to pass to the function the control name, in this case
'EmailAdd1' so I had done

Function ListLoop( sCtlName as Control) as String

With Screen.ActiveForm(sCtlName)

but this doesn't work. could someone offer me some guidance please.

Thank you,

QB
 
Question said:
I have a sub that uses code like:

With Me.EmailAdd1
...


I am trying to switch the sub into a function that I could use from multiple
forms....,but am experiencing some difficulties.

I would like to pass to the function the control name, in this case
'EmailAdd1' so I had done

Function ListLoop( sCtlName as Control) as String

With Screen.ActiveForm(sCtlName)

but this doesn't work. could someone offer me some guidance please.


A control's namr is a string, not a vontrol object.

Function ListLoop(sCtlName as String) as String
 
Back
Top