By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,640 Members | 2,355 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,640 IT Pros & Developers. It's quick & easy.

Set up text boxes in VBA

P: n/a
Please suggest some links or sources which show how to set up form text
boxes in VBA.

Thank you so much.

Jun 13 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Bill (Unique as my name) wrote:
Please suggest some links or sources which show how to set up form text
boxes in VBA.

Thank you so much.

What don't you understand?

You click on the toolbox wizard and select the AB control. Then you
drop in onto the form and place it where you want.

Then you open up the property sheet and set the properties. You might
set the caption for the label, whether you want it sunken or flat, the
background/foreground colors under the Format Tab. If it is bound to a
table, you click the Data tab and define the field it is bound to in the
table. Under the Events tab you enter the code/macro. Under Other, you
give the control a name beside the one provided when created. For
example, if the text field will store the LastName, change it from Text0
or whatever to LastName.
Jun 14 '06 #2

P: n/a
salad <oi*@vinegar.com> wrote in
news:Wj****************@newsread3.news.pas.earthli nk.net:
Bill (Unique as my name) wrote:
Please suggest some links or sources which show how to set up
form text boxes in VBA.

Thank you so much.
What don't you understand?


It's not what the o.p. doesn't understand, it's what you didn't
understand, he specified about doing it in code.
You click on the toolbox wizard and select the AB control.
Then you drop in onto the form and place it where you want.

Then you open up the property sheet and set the properties.
You might set the caption for the label, whether you want it
sunken or flat, the background/foreground colors under the
Format Tab. If it is bound to a table, you click the Data tab
and define the field it is bound to in the table. Under the
Events tab you enter the code/macro. Under Other, you give
the control a name beside the one provided when created. For
example, if the text field will store the LastName, change it
from Text0 or whatever to LastName.

The steps to adding a textbox in code is that you need to open
the form in design mode, Dim a new control object, set its name,
top, left, height and width properties, control source and any
other properties you want set, then save and close the form,
then reopen it in normal mode. That's a lot of coding for
something that really only needs doing once.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jun 14 '06 #3

P: n/a
Bob Quintal wrote:
salad <oi*@vinegar.com> wrote in
news:Wj****************@newsread3.news.pas.earthli nk.net:

Bill (Unique as my name) wrote:
Please suggest some links or sources which show how to set up
form text boxes in VBA.

Thank you so much.


What don't you understand?

It's not what the o.p. doesn't understand, it's what you didn't
understand, he specified about doing it in code.


Missed that one entirely. Thanks.

What the OP requested isn't your normal, everyday activity in coding.
Next, get him into ProcBodyLine and other module stuff so he can write
the code too.
Jun 14 '06 #4

P: n/a
* Bob Quintal:
salad <oi*@vinegar.com> wrote in
news:Wj****************@newsread3.news.pas.earthli nk.net:
Bill (Unique as my name) wrote:
Please suggest some links or sources which show how to set up
form text boxes in VBA.

Thank you so much.

The steps to adding a textbox in code is that you need to open
the form in design mode, Dim a new control object, set its name,
top, left, height and width properties, control source and any
other properties you want set, then save and close the form,
then reopen it in normal mode. That's a lot of coding for
something that really only needs doing once.


OK, I'll bite. Does "set up" mean to create text boxes, or simply alter
properties, such as visible, size and position?

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Jun 14 '06 #5

P: n/a
Bob Quintal <rq******@sPAmpatico.ca> wrote in
news:Xn**********************@66.150.105.47:
salad <oi*@vinegar.com> wrote in
news:Wj****************@newsread3.news.pas.earthli nk.net:
Bill (Unique as my name) wrote:
Please suggest some links or sources which show how to set up
form text boxes in VBA.

Thank you so much.

What don't you understand?


It's not what the o.p. doesn't understand, it's what you didn't
understand, he specified about doing it in code.


Why in the world would anyone do that?

I've been programming Access near fulltime since 1996 and never once
have I needed to do it.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jun 14 '06 #6

P: n/a
> OK, I'll bite. Does "set up" mean to create text boxes, or simply alter
properties, such as visible, size and position?
Thanks for the intelligent positive response, Randy.

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 somebody 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.

Thanks Randy.
Randy Harris wrote: * Bob Quintal:
salad <oi*@vinegar.com> wrote in
news:Wj****************@newsread3.news.pas.earthli nk.net:
Bill (Unique as my name) wrote:
Please suggest some links or sources which show how to set up
form text boxes in VBA.

Thank you so much.

The steps to adding a textbox in code is that you need to open
the form in design mode, Dim a new control object, set its name,
top, left, height and width properties, control source and any
other properties you want set, then save and close the form,
then reopen it in normal mode. That's a lot of coding for
something that really only needs doing once.


OK, I'll bite. Does "set up" mean to create text boxes, or simply alter
properties, such as visible, size and position?

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.


Jun 14 '06 #7

P: n/a
"David W. Fenton" <XX*******@dfenton.com.invalid> wrote in
news:Xn**********************************@127.0.0. 1:
Bob Quintal <rq******@sPAmpatico.ca> wrote in
news:Xn**********************@66.150.105.47:
salad <oi*@vinegar.com> wrote in
news:Wj****************@newsread3.news.pas.earthli nk.net:
Bill (Unique as my name) wrote:
Please suggest some links or sources which show how to set
up form text boxes in VBA.

Thank you so much.

What don't you understand?


It's not what the o.p. doesn't understand, it's what you
didn't understand, he specified about doing it in code.


Why in the world would anyone do that?

I've been programming Access near fulltime since 1996 and
never once have I needed to do it.

Neither have I. However see the O.P. response where he says he
has a form with 420 unbound controls.

I don't know what he's trying to acheive, but I wouldn't buy an
application from this guy.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jun 14 '06 #8

P: n/a
"Bill (Unique as my name)" <br******@yahoo.com> wrote in
news:11*********************@h76g2000cwa.googlegro ups.com:
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.


This sounds completely idiotic. Why in the *world* would you ever
contemplate such a thing?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jun 14 '06 #9

P: n/a
On 14 Jun 2006 11:26:29 -0700, "Bill (Unique as my name)" <br******@yahoo.com>
wrote:
OK, I'll bite. Does "set up" mean to create text boxes, or simply alter
properties, such as visible, size and position?


Thanks for the intelligent positive response, Randy.

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 somebody 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.

Thanks Randy.


I can't see any logic in what you are trying to achieve, however the method
would fail within a short period of time.

There is a finite limit (768 rings a bell) of the number of controls that can be
created on a form during the form's lifetime. Every control (including lines,
boxes etc) created in the form adds to this count. The count remains even if the
controls are deleted. Once the maximum count is reached, no more controls can be
added to the form either manually or by code.

If you already have 420 controls on your form, it probably wont be too long
before you hit the ceiling.
Wayne Gillespie
Gosford NSW Australia
Jun 15 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.