select statement

S

smk23

I have the following code:

Select Case strTab
Case "page1"
Set frm = Me.frmPage1.Form

How can I rewrite this to something like

Set frm= Me. & "strTab" & .Form
 
D

Dirk Goldgar

smk23 said:
I have the following code:

Select Case strTab
Case "page1"
Set frm = Me.frmPage1.Form

How can I rewrite this to something like

Set frm= Me. & "strTab" & .Form

If strTab contains the name of a subform control on the main form, as
your pseudocode implies, it would be something like

Set frm = Me.Controls(strTab).Form

or

Set frm = Me.Controls("frm" & strTab).Form

depending on whether strTab contains the complete name of the control,
or needs to have the "frm" prefix stuck on the front.
 
Top