Hi all,
I need to refer to form controls (list boxes) dependent upon selection from a combo.
E.g. if a particular option (data criteria for a form) is selected from a combo - it makes the selected control (list box) visible, ready for the user to select items (criteria options) from that control.
In order to do this, I need to pass a control name parameter to a function as data type Control ('ListBox').
e.g.
Public Sub ShowListbox(lst as Listbox)
...
lst.Visible = TRUE
...
End Sub
I can call the above with a literal control name:
Call ShowListBox (lstNation)
and it works.
I want to store 'lstNation' in a table, but can only store it as a string - which is not recognised as a control when I pass it as a parameter.
Is my only option to enumerate the form's objects? If so, how do I compare the stored string in the table to the list of form objects - in order to select them to make them visible?
Any help much appreciated.
ATB
Darrylle
Can I store a control name in a table, retrieve it and refer to it as a data-type of 'control'?
Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
I need to refer to form controls (list boxes) dependent upon selection from a combo.
E.g. if a particular option (data criteria for a form) is selected from a combo - it makes the selected control (list box) visible, ready for the user to select items (criteria options) from that control.
In order to do this, I need to pass a control name parameter to a function as data type Control ('ListBox').
e.g.
Public Sub ShowListbox(lst as Listbox)
...
lst.Visible = TRUE
...
End Sub
I can call the above with a literal control name:
Call ShowListBox (lstNation)
and it works.
I want to store 'lstNation' in a table, but can only store it as a string - which is not recognised as a control when I pass it as a parameter.
Is my only option to enumerate the form's objects? If so, how do I compare the stored string in the table to the list of form objects - in order to select them to make them visible?
Any help much appreciated.
ATB
Darrylle
Can I store a control name in a table, retrieve it and refer to it as a data-type of 'control'?
Never argue with an idiot, he'll bring you down to his level - then beat you with experience.