Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a text box in vba for Access

Status
Not open for further replies.

eloise

Programmer
Jan 31, 2002
20
0
0
US
Hi there

Does anyone know how to create a text box in Access VBA. I want to create a text box for each recordset returned. Thank you in advance.
 
From Access Help.....

The following example first creates a new form based on an Orders table. It then uses the CreateControl function to create a text box control and an attached label control on the form.

Sub NewControls()
Dim frm As Form
Dim ctlLabel As Control, ctlText As Control
Dim intDataX As Integer, intDataY As Integer
Dim intLabelX As Integer, intLabelY As Integer

' Create new form with Orders table as its record source.
Set frm = CreateForm
frm.RecordSource = "Orders"
' Set positioning values for new controls.
intLabelX = 100
intLabelY = 100
intDataX = 1000
intDataY = 100
' Create unbound default-size text box in detail section.

Set ctlText = CreateControl(frm.Name, acTextBox, , "", "", _
intDataX, intDataY)
' Create child label control for text box.
Set ctlLabel = CreateControl(frm.Name, acLabel, , ctlText.Name, _
"NewLabel", intLabelX, intLabelY)
' Restore form.
DoCmd.Restore
End Sub There are two ways to write error-free programs; only the third one works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top