A.D.Tejpal
adtp at touchtelindia.net
Thu Jul 1 00:23:05 CDT 2004
Oleg,
The code given below should create an array of four text boxes named Txt_1 to Txt_4 on form named F_TestNewControlsArray.
Regards,
A.D.Tejpal
---------------
===============================
Sub CreateNewControlsArray()
Dim intLeft As Integer, intTop As Integer
Dim Fnm As String, ctl(4) As Control, Cnt As Integer
Fnm = "F_TestNewControlsArray"
DoCmd.OpenForm Fnm, acDesign
intLeft = 100
For Cnt = 1 To 4
If Cnt > 1 Then
intTop = ctl(Cnt - 1).Top + ctl(Cnt - 1).Height + 100
Else
intTop = 100
End If ' Cnt > 1
Set ctl(Cnt) = CreateControl(Fnm, acTextBox, , "", "", _
intLeft, intTop)
ctl(Cnt).Name = "Txt_" & Cnt
Next ' Cnt
DoCmd.Close acForm, Fnm, acSaveYes
DoCmd.OpenForm Fnm, acNormal
DoCmd.Maximize
Forms(Fnm).SetFocus
For Cnt = 1 To 4
Set ctl(Cnt) = Nothing
Next ' Cnt
End Sub
===============================
----- Original Message -----
From: Oleg_123 at xuppa.com
To: accessd at databaseadvisors.com
Sent: Wednesday, June 30, 2004 06:47
Subject: [AccessD] text box array
Hey
I have to create text box array, and i don't qite remember how to go about it right now i am just trying to create textbox via code, and can't find anthing on it...
Private Sub Command6_Click()
Dim x As Control
Dim y As TextBox
Set y = New TextBox
y.Width = 1
y.Height = 0.5
y.Left = 1
y.Top = 0.6
y.Visible = True
End Sub