Here is my code:
Private Sub cmdDetailsNext_Click()
Dim frm As Form
Dim ctlLabel As control, ctlControl As control, ctlName As Variant
Dim intLabelX As Integer, intLabelY As Integer
Dim intDataX As Integer, intDataY As Integer
Dim intTabIndex As Integer
Dim fld As Field
Dim rst As Recordset
Dim db As Database
Set db = CurrentDb
Set rst = db.OpenRecordset("qryCreateForm")
'Set ProjectName Value
ProjectName = Forms!frmDetails!txtProjectName
'Open "frmCustomForm" form in design view
DoCmd.OpenForm "frmCustomTakeoff", acDesign
Set frm = Forms!frmCustomTakeoff
' Set positioning values for new controls
intTabIndex = 0
intLabelX = 100
intLabelY = 100
intDataX = 1000
intDataY = 100
For Each fld In rst.Fields
ctlName = fld.Name
Set ctlControl = CreateControl(frm.Name, acTextBox, , , fld.Name, intDataX, intDataY)
'Create child label control for text box
Set ctlLabel = CreateControl(fld.Name, acLabel, , ctlControl.Name, "'" & fld.Name & "'", intLabelX, intLabelY)
intLabelY = intLabelY + 300
intDataY = intDataY + 300
'Restore from
DoCmd.Restore
Next
End Sub
I get a run-time error:Too few parameters. Expected 1 in the line that is red. What is it that I am missing.
Scott
Private Sub cmdDetailsNext_Click()
Dim frm As Form
Dim ctlLabel As control, ctlControl As control, ctlName As Variant
Dim intLabelX As Integer, intLabelY As Integer
Dim intDataX As Integer, intDataY As Integer
Dim intTabIndex As Integer
Dim fld As Field
Dim rst As Recordset
Dim db As Database
Set db = CurrentDb
Set rst = db.OpenRecordset("qryCreateForm")
'Set ProjectName Value
ProjectName = Forms!frmDetails!txtProjectName
'Open "frmCustomForm" form in design view
DoCmd.OpenForm "frmCustomTakeoff", acDesign
Set frm = Forms!frmCustomTakeoff
' Set positioning values for new controls
intTabIndex = 0
intLabelX = 100
intLabelY = 100
intDataX = 1000
intDataY = 100
For Each fld In rst.Fields
ctlName = fld.Name
Set ctlControl = CreateControl(frm.Name, acTextBox, , , fld.Name, intDataX, intDataY)
'Create child label control for text box
Set ctlLabel = CreateControl(fld.Name, acLabel, , ctlControl.Name, "'" & fld.Name & "'", intLabelX, intLabelY)
intLabelY = intLabelY + 300
intDataY = intDataY + 300
'Restore from
DoCmd.Restore
Next
End Sub
I get a run-time error:Too few parameters. Expected 1 in the line that is red. What is it that I am missing.
Scott