Solved

Create Dynamic Form

Posted on 2004-09-28
4
163 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
ID: 12176749
Dim frm As Form

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

Author Comment

by:MaxTo
ID: 12176780
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
ID: 12176788
Hi AzraSound,
Thanks for your help....

I found the solution.


Max

0
 
LVL 28

Expert Comment

by:AzraSound
ID: 12176791
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

895 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

14 Experts available now in Live!

Get 1:1 Help Now