Link to home
Start Free TrialLog in
Avatar of binita11
binita11

asked on

Open form by variable

Hi
do u have any idea to open a form dynamically by putting the form name in some variable and open the form using that variable.
eg.
dim x as variable
x.show 'must open the form whose name is stored by x

thanks

Avatar of fatalXception
fatalXception

If you have a form, say called frmUserInput:

then you can say this:

Dim newForm as frmUSerInput

and later on
set newform = new frmUserInput
newform.show vbmodal and so on.

HTH
Avatar of Mike Tomlinson
Assuming VB6:

Private Sub Command1_Click()
    Dim frmName As String
    frmName = "Form2"
   
    Dim frm As Form
    Set frm = Forms.Add(frmName)
    frm.Show
End Sub
ASKER CERTIFIED SOLUTION
Avatar of GuryTraub
GuryTraub

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial