In this code, I have a commandbutton array, a textbox array, and a frame array. I am trying to dynamically create them based on a database and then resize them. I can't figure out why this doesn't work. The program fails at the area highlighted below with 'object does not support this property or method' error. Any ideas?
Dim cmdobj As CommandButton
Dim txtobj As TextBox
Load Frame1(1)
With Frame1(1)
.Visible = True
.Caption = "Dynamic Frame"
End With
For i = 1 To 5
Load Command1(i)
Load Text1(i)
With Command1(i)
.Visible = True
Set .Container = Form1!Frame1(1)
.Caption = i
.Top = i * Command1(i).Height
.Left = 200
End With
With Text1(i)
.Visible = True
Set .Container = Form1!Frame1(1)
.Top = i * Command1(i).Height
.Left = 220 + Command1(i).Width
.Text = ""
End With
Frame1(1).Height = 15
For Each txtobj In Form1!Frame1(1)
Frame1(1).Height = txtobj.Height + Frame1(1).Height
Next
Next
Thanks,
Elena
Dim cmdobj As CommandButton
Dim txtobj As TextBox
Load Frame1(1)
With Frame1(1)
.Visible = True
.Caption = "Dynamic Frame"
End With
For i = 1 To 5
Load Command1(i)
Load Text1(i)
With Command1(i)
.Visible = True
Set .Container = Form1!Frame1(1)
.Caption = i
.Top = i * Command1(i).Height
.Left = 200
End With
With Text1(i)
.Visible = True
Set .Container = Form1!Frame1(1)
.Top = i * Command1(i).Height
.Left = 220 + Command1(i).Width
.Text = ""
End With
Frame1(1).Height = 15
For Each txtobj In Form1!Frame1(1)
Frame1(1).Height = txtobj.Height + Frame1(1).Height
Next
Next
Thanks,
Elena