Solved

Create Dynamic Form

Posted on 2004-09-28
4
165 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

856 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