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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a Textbox 1

Status
Not open for further replies.

tyang01

Technical User
Feb 1, 2007
46
US
I am having trouble creating a textbox through VBA. It doesn't give me any errors although the textbox will not appear on the form. Can someone help me out?

Here is a sample of the code.
Set txtAppT = CreateControl("AppTitle", acTextBox, "")
' Set txtAppT = New TextBox
With txtAppT
.Name = "AppTitle"
.Height = 100
.Width = 100
.Enabled = True
.Top = 100
.Left = 100
.Visible = True
End With
 
I ran this code to test your methods and discovered that the new control was almost invisible because 100 twips ain't that big!

Dim ctlNew As Control
Dim frmNew

Set frmNew = CreateForm(CurrentDb.name)
Set ctlNew = CreateControl(frmNew.name, acTextBox, acDetail, , , 0, 0, 100, 100)
With ctlNew
.name = "AppTitle"
End With


Also setting the section parameter to an empty string probaly didn't help...

I hope this helps.
 
FYI, 1440 Twips = 1 Inch.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top