array of textbox

hdnmd97

New Member
Joined
Nov 15, 2008
Messages
5
I would like to create an array of text box on a form
textbox(1)
textbox(2)
textbox(3)
textbox(4)
textbox(5)
textbox(6)
in access. Please help.

Thank you
Han
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi, do you mean how to create textboxes dynamically on a form?

perhaps something like...
Code:
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
 
Upvote 0

Forum statistics

Threads
1,225,156
Messages
6,183,226
Members
453,152
Latest member
ChrisMd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top