Here is a simple module I just wrote. It opens a already designed form in design view, adds a label, closes and saves the form and then reopens it in form view. Hope this helps.
Quote:
Public Sub addlbl()
Dim lbl As Label
DoCmd.OpenForm "abc", acDesign
Set lbl = CreateControl("abc", acLabel, acDetail, , , 5000, 5000, 5000, 5000)
With lbl
.Caption = "HELLO"
.FontName = "ARIAL"
.FontBold = True
.FontSize = 11
.ForeColor = 255
End With
DoCmd.Close acForm, "abc", acSaveYes
DoCmd.OpenForm "abc"
End Sub
|