Hi, i'm trying to write a module that creates a form to store notes about all the forms in a database. I need it so that i can import it into any database and it will work. So far it works but only stores the last form name that it finds because i haven't based the form i've created on a table so it can't add a new record. Can anyone give me the code to create a table called "Form_Details" with two text fields ("Form_Name" and "Notes") so that I can finish it off, i tried stuff in the help (executing a CREATE sql) but didn't get very far, Thanks, Tom.
Here is the code i've got so far if it helps...
Option Compare Database
Dim obj As AccessObject, dbs As Object
Sub Form_Information()
Dim frm As Form
Dim ctl As Control
Dim intDataX As Integer, intDataY As Integer, twip As Integer
Dim strForm As String
Set dbs = Application.CurrentProject
twip = 567 'Enables lengths in cm
intDataX = 3 * twip
intDataY = 0.1 * twip
strForm = "Form_Details"
Set frm = CreateForm
With frm
.DefaultView = 1
.Section(acDetail).Height = 1000
End With 'creates continuous form
Set ctlText = CreateControl(frm.Name, acTextBox, , "", "", _
intDataX, intDataY)
Set ctlText = CreateControl(frm.Name, acTextBox, , "", "", _
intDataX, intDataY) 'Adds controls for form names and notes
DoCmd.Save acDefault, strForm
DoCmd.OpenForm strForm, acNormal 'saves and opens form in normal view
For Each obj In dbs.AllForms
Forms![Form_Details]![text0] = obj.Name
DoCmd.GoToRecord acDataForm, strForm, acNewRec
Next ' puts the name of each form in the text box created
End Sub
Here is the code i've got so far if it helps...
Option Compare Database
Dim obj As AccessObject, dbs As Object
Sub Form_Information()
Dim frm As Form
Dim ctl As Control
Dim intDataX As Integer, intDataY As Integer, twip As Integer
Dim strForm As String
Set dbs = Application.CurrentProject
twip = 567 'Enables lengths in cm
intDataX = 3 * twip
intDataY = 0.1 * twip
strForm = "Form_Details"
Set frm = CreateForm
With frm
.DefaultView = 1
.Section(acDetail).Height = 1000
End With 'creates continuous form
Set ctlText = CreateControl(frm.Name, acTextBox, , "", "", _
intDataX, intDataY)
Set ctlText = CreateControl(frm.Name, acTextBox, , "", "", _
intDataX, intDataY) 'Adds controls for form names and notes
DoCmd.Save acDefault, strForm
DoCmd.OpenForm strForm, acNormal 'saves and opens form in normal view
For Each obj In dbs.AllForms
Forms![Form_Details]![text0] = obj.Name
DoCmd.GoToRecord acDataForm, strForm, acNewRec
Next ' puts the name of each form in the text box created
End Sub