Solved

Create Dynamic Form

Posted on 2004-09-28
4
162 Views
Last Modified: 2010-05-18
Hi all Experts,

I got a project, i used the tree view to be the menu, In the nodes i store the "form name" from database into the node.tag.
So when i click on the node, i return the tag, so i know which form to be call.
Example i got three form name
frmabout, frmLogin, frmHow
for the easy way is

if node.tag = "frmabout" then frmabout.show
if node.tag = "frmLogin" then frmLogin.show
if node.tag = "frmHow" then frmHow.show

if i got 100 form then i need to write 100 statements...

so can i combine allstatement to one? Just dynamic the code to be used to calling all forms.

Thanks....

Max
0
Comment
Question by:MaxTo
  • 2
  • 2
4 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 77 total points
Comment Utility
Dim frm As Form

Set frm = Forms.Add(node.tag)
frm.Show
0
 

Author Comment

by:MaxTo
Comment Utility
Hi AzraSound,

The function u privide is work, but it will appear more than one form for the particular form, how i can make it just show one, and if it was open and not active then how i can make it to be active form?


Thanks..

Max
0
 

Author Comment

by:MaxTo
Comment Utility
Hi AzraSound,
Thanks for your help....

I found the solution.


Max

0
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
Public Function GetOpenForm(ByVal FormName As String) As Form
    Dim frm As Form

    For Each frm In Forms
        If frm.Name = FormName Then
            Set GetOpenForm = frm
            Exit Function
        End If
    Next
End Function



Dim frm As Form

Set frm = GetOpenForm(node.tag)
If frm Is Nothing Then
    Set frm = Forms.Add(node.tag)
End If
frm.Show
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now