Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working With CreateForm()

Status
Not open for further replies.

rgbanse

MIS
Jun 4, 2001
211
US
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top