-
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
-
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.
-
do you want them to be set as parents or children?
-
May be I misunderstood you, but you can have only one MDI parent form to a project.
-
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]
-
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