Results 1 to 6 of 6

Thread: MDI child forms

  1. #1

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444
    I have one mdi child form with some database controls and other controls on it.
    the first mdi form is called MdiFrm1
    I would like to programatically make a MdiFrm2 and so on.
    Each form would be the same with the exceptions as follows: Unique Name, Caption, values in certain text boxes, and relating to a table in the database. Each table in the database will be named the same as the caption on the MdiFrm

    This is an electrical panel schedule manager. mdifrm1 will be panel A,mdifrm2 will be panel B and so on. Some times the panels will be called 2A for second floor first panel or some other minor human variances. Because I can not guarante(or spell) the panel names will be sequential I will make that a text box input on the form.
    The data input on the mdifrm will go into a table in an access database. the database will have as many tables as there are mdifrms.
    I have the first mdifrm and table created. I Need to be able to make a copy of each when the user wants to input a new panel schedule.
    any input, ideas, thoughts will be apprecaited. I have just started this program and this mdifrm idea may not be the best. The company has decided on the use of a database so that is fixed.
    thank you for your time and have a good day
    I am so skeptical, I can hardly believe it!
    PS I am not a 'hyperactive member' I am a cool, calm, and collected member

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655

    Unhappy

    Sorry, I just tested some code for creating a new form through code and tried to define it as an MDIForm, but it seems VB doesn't like that.

  3. #3
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    do you want them to be set as parents or children?

  4. #4
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    May be I misunderstood you, but you can have only one MDI parent form to a project.

  5. #5

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444
    I want all the new forms to be children
    this is what I am using now.
    Code:
    Private Sub LoadNewDoc()
        'table2 is a template table. each child form should point
        'to a new table with a name=to the caption of the child form
        Dim frmD As frmDocument
        Dim StrTemp As String 'name of panel
        Set frmD = New frmDocument 'create a child form based on the model
        StrTemp = InputBox("enter Panel Name", "Panel Name?") 'Get name for this panel
        frmD.Caption = StrTemp 'set child window caption to the panel name
        Call CopyTable("c:\test\db1.mdb", "table2", StrTemp) 'copy table 2 to the name of the panel
        frmD.Data1.RecordSource = StrTemp 'try to get the new mdi form to point to the new table
        frmD.DBGrid1.DataSource = frmD.Data1 'get the grid to point to the data control
        frmD.Show 'show the user what they've won!
    End Sub
    thank you all for your time and replies

    [Edited by badgers on 05-22-2000 at 06:08 PM]
    I am so skeptical, I can hardly believe it!
    PS I am not a 'hyperactive member' I am a cool, calm, and collected member

  6. #6

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444
    BTW i get an error in the above code
    Run-time error '430':
    Class does not support Automation or does not support expected interface.
    at the line:
    Code:
       frmD.DBGrid1.DataSource = frmD.Data1 'get the grid to point to the data control
    sorry for this post scrolling to the right
    My big problem is getting the new form to point to the new table.
    thank you for your time and have a good day
    I am so skeptical, I can hardly believe it!
    PS I am not a 'hyperactive member' I am a cool, calm, and collected member

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width