Displaying Form.....

Posted on 2000-03-17
Last Modified: 2010-05-02
I have one text box......

then a user enters a form name in this textbox.....Now how do i display this  form object.....

Question by:tapsbin
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

Expert Comment

ID: 2630337
Can you give a little more information?

Are you giving the user a list of possible forms to enter?

If so, you should probably use a Select Case statement.

For example:

Select Case textbox.text
     case "Main"
     case "About"
     case else
          msgbox "Please Enter A Valid Form"
end Select

That is a simple example in which the user is presented with a list of forms to select.

Please respond and let me know if I understood your question.  If not please explain where I missed the mark.


Expert Comment

ID: 2630433
willecoy is correct. as far as i know, thats the way to do it.
but instead of using a text box, y dont u use a combo box and populate them with the form names. by this way, the user can select the form to be displayed by clicking on the combo box.
check it out...
LVL 70

Expert Comment

by:Éric Moreau
ID: 2630441
You should list your form in a listbox to help user!!!
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!


Expert Comment

ID: 2630607
If you "pre-load" all your forms, then this is a good way to do it:

For Each Form In Forms
    If Form.Name = Text1.Text Then
        FormFound = True
        Exit For
    End If
If Not FormFound Then MsgBox "No such form!"

Problem is: the Forms collection only contains loaded forms.
LVL 15

Expert Comment

ID: 2631201
Private Sub Text1_KeyPress(KeyAscii As Integer)
    On Error Resume Next
    If KeyAscii = vbKeyReturn Then Forms.Add(Text1.Text).Show ' requires VB6 SP3
End Sub
LVL 15

Accepted Solution

ameba earned 50 total points
ID: 2631228
Option Explicit

Private Sub Form_Load()
    Text1.Text = "Form1"
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    Dim frm As Form
    On Error GoTo EH
    If KeyAscii = vbKeyReturn Then
        Set frm = Forms.Add(Text1.Text)
        frm.Move Me.Left + 300, Me.Top + 300
        KeyAscii = 0 ' prevent beep
    End If
    Exit Sub
    MsgBox Err.Description
End Sub

Author Comment

ID: 2651828
Will test and respond to you quickly.....

Author Comment

ID: 4121294
i have field with different form name. While looping through the field values, it should also invoke an instance of that form object, as well as should keep track of that instance, as and when needs to be fetched.


Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…

695 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