-
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
-
could it be that I have the wrong references?
-
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