Sub ExampleAddControl()
Dim ctrlTextBox As TextBox, i As Integer, objForm As Form
'Open form in design view
DoCmd.OpenForm "Form2", acDesign
'Set an object to refer to the form
Set objForm = Application.Forms("Form2")
' Set positioning values for new controls.
intDataX = 1000 'x axis ie horizontal
intDataY = 100 'y axis ie vertical
'Loop through 6 times to create 6 textboxes
For i = 1 To 6
'Create textbox
Set ctrlTextBox = CreateControl(objForm.Name, acTextBox, , "", "", _
intDataX, intDataY)
'Amend name of textbox. Not entirely necessary as box will automaticall be named TextBox0 to 5
ctrlTextBox.Name = "TextBox" & i
'Increment Y axis by 400 so new textbox is below the previous one
intDataY = intDataY + 400
Next i
End Sub