Results 1 to 3 of 3

Thread: Address a specific mdi child form and its controls

  1. #1

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444
    I am trying to figure some stuff out.
    I have a frmDocument that is the model for all the mdi children.(used the VB wizard and took all the defaults)
    I have modified the wizard sub for creating the new mdi child form.
    frmDocument has a data control and a DBgrid on it.

    when the user clicks to create a new mdi child form I want the flowing to happen.
    make a new table in access with a user input name
    make the caption of the new form=to the above user input
    get the data control on the new form to point to/at the new access table
    show the new form.

    Each form is intended to represent an electric power panel.
    The database will have one table per panel. There will be other tables in the database(maybe)
    here is the code:
    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 ***gives error***
        frmD.Show 'show the user what they've won!
    End Sub
    as noted the error I get is
    #430
    Class does not support Automation or does not support expected interface
    I have referenced the following
    VB for apps
    VB runtime objects and procedures
    VB objects and procedures
    OLE automation
    MS DAO 2.5/3.5 Compatibility Library

    I am using VB6 W/SP3
    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

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444
    could it be that I have the wrong references?
    I am so skeptical, I can hardly believe it!
    PS I am not a 'hyperactive member' I am a cool, calm, and collected member

  3. #3

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444
    how about this, I am trying to break this down to simple pieces
    single form with data1 and dbgrid1
    using a command button with the following code:
    Code:
    Private Sub Command1_Click()
    Data1.RecordSource = "Table2"
    Data1.Refresh
    DBGrid1.Refresh
    End Sub
    I was hoping to get the data grid to stop showing the info in table1 and start showing the info in table2
    I don't get an error but I dont see the infomation that table2 contains.

    What am I doing wrong?
    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