Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Create Dynamic Form

Posted on 2004-09-28
4
Medium Priority
?
169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 308 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

715 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