Show form using variable

Greeting,

  In conventional way, I use

     formName.show

to show a form. I just want to know can  i declare a variable to store the form name, so later on  i can show the form depends on the value in the variable ?

If yes. How ?

Thanks for replying ......

PandaYongAsked:
Who is Participating?
 
CimperialiConnect With a Mentor Commented:
Dim frmX As Form
Dim strName As String
Dim bFounded As Boolean
strName = "Form1"
'look if form is already loaded
For Each frmX In Forms
   If frmX.Name = strName Then
      bFounded = True
      'already exists in forms, simply show to put it visible and focused
      frmX.Show
      'exit loop
      Exit For
   End If
Next
If Not bFounded Then
   'form is not loaded, thus add it to forms collection
   Set frmX = Forms.Add(strName)
   'now you can show it
   frmX.Show
End If
0
 
Mohammed NasmanSoftware DeveloperCommented:
Hello

  You mean like this?

Private Sub Command1_Click()
  Dim frm As Form
  Set frm = New Form2
  frm.Show
End Sub
0
 
VBtomCommented:
you ask the same question twice :(
Look at the other place you asked this question
http://www.experts-exchange.com/Programming/Q_20557035.html
0
 
PandaYongAuthor Commented:
Thank You !
Thank You to everyone who is helping.
0
All Courses

From novice to tech pro — start learning today.