F
FGM
windows 2000, Access 2002
I would like to add a label or textbox using vba. It tells me you need to
be in design view. I want to check to see if a textbox or label exists and
if it does not to add it and set the properties.
Can this be done? I tried the following. I want to do this when a user is
openning the form.
thanks.
I tried this:
Private Sub Form_Open(Cancel As Integer)
Dim txt1 As Access.TextBox
Dim frm1 As Access.Form
'Set frm1 = "frmTest"
Dim intLeft As Integer
Dim intOffset As Integer
Dim intwidth As Integer
Dim intHeight As Integer
Dim intLastTop As Integer
intLeft = 144
intOffset = 72
intwidth = 4320
intHeight = 288
Set txt1 = CreateControl("frmTest", acTextBox)
With txt1
..Left = intLeft
..Top = intLastTop + intHeight + intOffset
intLastTop = .Top
..Width = intwidth
..Height = intHeight
..NAME = "txtName"
End With
End Sub
I would like to add a label or textbox using vba. It tells me you need to
be in design view. I want to check to see if a textbox or label exists and
if it does not to add it and set the properties.
Can this be done? I tried the following. I want to do this when a user is
openning the form.
thanks.
I tried this:
Private Sub Form_Open(Cancel As Integer)
Dim txt1 As Access.TextBox
Dim frm1 As Access.Form
'Set frm1 = "frmTest"
Dim intLeft As Integer
Dim intOffset As Integer
Dim intwidth As Integer
Dim intHeight As Integer
Dim intLastTop As Integer
intLeft = 144
intOffset = 72
intwidth = 4320
intHeight = 288
Set txt1 = CreateControl("frmTest", acTextBox)
With txt1
..Left = intLeft
..Top = intLastTop + intHeight + intOffset
intLastTop = .Top
..Width = intwidth
..Height = intHeight
..NAME = "txtName"
End With
End Sub