I want to create a form with VBA and have the ability to assign its name within the code rather than doing the Save,Close,Rename thing. I would also like to be able to assign the names to labels and text boxes within the form.
Current code follows.
thx in advance
RGB
Function NewForm()
Dim frm As Form
Dim MessageTextBox01 As Control
Dim MessageTextBox01Label As Control
Set frm = CreateForm()
frm.Width = 6480 '4.5 inches
frm.Caption = "Current Activity Display Form"
frm.AutoCenter = True
frm.AutoResize = True
frm.RecordSelectors = False
frm.NavigationButtons = False
Set MessageTextBox01Label = CreateControl(frm.Name, acLabel, , , " Current Activity ", 2450, 425, 5670, 300)
Set MessageTextBox01 = CreateControl(frm.Name, acTextBox, , , , 275, 700, 5670, 300)
frm.Text1.Enabled = False
frm.Text1.Locked = True
DoCmd.Save
DoCmd.close
DoCmd.Rename "CurrentActivityDisplay", acForm, "Form1"
DoCmd.OpenForm "CurrentActivityDisplay"
Forms!CurrentActivityDisplay.Text1 = "Message Here"
Forms!CurrentActivityDisplay.Text1.TextAlign = 2
End Function
Current code follows.
thx in advance
RGB
Function NewForm()
Dim frm As Form
Dim MessageTextBox01 As Control
Dim MessageTextBox01Label As Control
Set frm = CreateForm()
frm.Width = 6480 '4.5 inches
frm.Caption = "Current Activity Display Form"
frm.AutoCenter = True
frm.AutoResize = True
frm.RecordSelectors = False
frm.NavigationButtons = False
Set MessageTextBox01Label = CreateControl(frm.Name, acLabel, , , " Current Activity ", 2450, 425, 5670, 300)
Set MessageTextBox01 = CreateControl(frm.Name, acTextBox, , , , 275, 700, 5670, 300)
frm.Text1.Enabled = False
frm.Text1.Locked = True
DoCmd.Save
DoCmd.close
DoCmd.Rename "CurrentActivityDisplay", acForm, "Form1"
DoCmd.OpenForm "CurrentActivityDisplay"
Forms!CurrentActivityDisplay.Text1 = "Message Here"
Forms!CurrentActivityDisplay.Text1.TextAlign = 2
End Function