If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Frankenstein Text Boxes
I have a blank form. My interest is threefold: 1) I want to create
textboxes, 2) to be able to change the name of the text boxes, 3) to change their location on the form. I have a form with 420 unbound textboxes. When the form opens, a VBA function runs a loop with three lengthy lines, each with its own monstrous dlookup statement, which determines the values of the forms textboxes. It took a while to set up the textboxes on the form and to rename them so that the VBA function would work. The VBA part was a breeze once Doug and others helped me with the code syntax. Now I want to be brave and bold. All I need is a single example that creates a textbox, gives it a name, and sets some standard property values and the location. That would be wonderful. Or if you have some handy links, that also would be a blessing. I've looked around and found a message which shows how to create a form in VBA and save it. But for the present, I just want to know about textboxes. Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! |
#2
|
|||
|
|||
Frankenstein Text Boxes
I have a blank form. My interest is threefold: 1) I want to create
textboxes in VBA, 2) to be able to change the name of the text boxes in VBA, 3) to change their location on the form in VBA. I have a form with 420 unbound textboxes. When the form opens, a VBA function runs a loop with three lengthy lines, each with its own monstrous dlookup statement, which determines the values of the forms textboxes. It took a while to set up the textboxes on the form and to rename them so that the VBA function would work. The VBA part was a breeze once Doug and others helped me with the code syntax. Now I want to be brave and bold. All I need is a single example that creates a textbox, gives it a name, and sets some standard property values and the location. That would be wonderful. Or if you have some handy links, that also would be a blessing. I've looked around and found a message which shows how to create a form in VBA and save it. But for the present, I just want to know about textboxes. Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you |
#3
|
|||
|
|||
Frankenstein Text Boxes
All I need is a single example that creates a textbox, gives it a name,
and sets some standard property values and the location. That would be wonderful. Or if you have some handy links, that also would be a blessing. Bill, Here is what I used to dynamically create my textboxes: ***** Dim fld as DAO.Field Dim TempHoldingRS as DAO.Recordset Dim frm as Form 'frm is created dynamically, assumes the name "Form1" 'Since you found form creating code, I will omit 'Looks at the fields in the holding table and creates a form based on those fields For Each fld In TempHoldingRS.Fields With CreateControl(frm.Name, ControlType:=acTextBox, _ Section:=acDetail, Parent:="", Columnname:=fld.Name, _ Left:=intNewLeft, Top:=0) .Name = fld.Name intNewLeft = intNewLeft + .Width .Locked = True .Enabled = False End With Next fld ***** I think this is what you are looking for, if I understood correctly. Hope it helps -Nick -- Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
Frankenstein Text Boxes
Thanks for the kind assistance, Nick.
Nick via AccessMonster.com wrote: All I need is a single example that creates a textbox, gives it a name, and sets some standard property values and the location. That would be wonderful. Or if you have some handy links, that also would be a blessing. Bill, Here is what I used to dynamically create my textboxes: ***** Dim fld as DAO.Field Dim TempHoldingRS as DAO.Recordset Dim frm as Form 'frm is created dynamically, assumes the name "Form1" 'Since you found form creating code, I will omit 'Looks at the fields in the holding table and creates a form based on those fields For Each fld In TempHoldingRS.Fields With CreateControl(frm.Name, ControlType:=acTextBox, _ Section:=acDetail, Parent:="", Columnname:=fld.Name, _ Left:=intNewLeft, Top:=0) .Name = fld.Name intNewLeft = intNewLeft + .Width .Locked = True .Enabled = False End With Next fld ***** I think this is what you are looking for, if I understood correctly. Hope it helps -Nick -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Linking text boxes | Volunteer Mom | Publisher | 7 | November 12th, 2008 01:29 AM |
Newbie table Layout (Posted as suggested by Tom Lake for feedback) | Little Penny | Using Forms | 2 | December 25th, 2005 04:44 PM |
Word applies direct format on File open | Uriel | General Discussion | 16 | November 27th, 2005 07:22 PM |
Query for 'confirmation' | rogge | Running & Setting Up Queries | 8 | April 19th, 2005 03:26 PM |
Change font of part of text | John | Powerpoint | 7 | March 15th, 2005 10:10 AM |