![]() |
|
|
#1
|
|||
|
|||
|
how i can make a dynamic textbox at runtime using VBA
iam using access 2003 for ex: when form open i want to create 10 textbox |
|
#2
|
|||
|
|||
|
Hello:
What you want to do is use the "CreateControl" method if you want to create controls dynamically when you need them. Example The following example first creates a new form based on an Orders table. It then uses the CreateControl method 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 |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| total in textbox | micfly | Access | 3 | 11-09-2008 08:24 AM |
| Dynamic SQL Query | Squeaner | Queries | 0 | 09-25-2008 12:37 PM |
| Textbox will not allow input | cwf | Forms | 0 | 04-04-2008 02:08 PM |
| Dynamic Query Outer Join Problem | mjack003 | Queries | 0 | 07-21-2006 11:07 AM |
| Report will not print a bound textbox | vvrt | Reports | 0 | 03-16-2006 11:16 AM |