Control.text property limitation?

D

Doug

I have a textbox control on a form which is bound to a memo field. I have a
particular function which allows you to highlight some text in the field and
replace it with a pre-defined text phrase. All of this works great except I
have run into a few records which contain about 6500 characters of text.

Once the replacement code is run an error occurs. The error occurs when the
..text property of the control is set to the new string value created by
concatenating the original text with the replpacement phrase. The same
number of characters are retrieved from the control as as are being put
back.

The error which occurs is:

Run-time error '2176':
The setting for this property is too long.

There does not appear to be any information on this in the online help or
microsoft's knowledge base online. I have since discovered this error is due
to the amount of text being inserted to the .text property of the control.

Can anyone tell me where I can find some documentation on the properties and
methods of various form controls? Even the .text property doesnt appear to
be a documented property.

Any thoughts on a workaround for this problem??

Many thanks in advance.

Doug
 
D

Dirk Goldgar

Doug said:
I have a textbox control on a form which is bound to a memo field. I
have a particular function which allows you to highlight some text in
the field and replace it with a pre-defined text phrase. All of this
works great except I have run into a few records which contain about
6500 characters of text.

Once the replacement code is run an error occurs. The error occurs
when the .text property of the control is set to the new string value
created by concatenating the original text with the replpacement
phrase. The same number of characters are retrieved from the control
as as are being put back.

The error which occurs is:

Run-time error '2176':
The setting for this property is too long.

There does not appear to be any information on this in the online
help or microsoft's knowledge base online. I have since discovered
this error is due to the amount of text being inserted to the .text
property of the control.

Can anyone tell me where I can find some documentation on the
properties and methods of various form controls? Even the .text
property doesnt appear to be a documented property.

Any thoughts on a workaround for this problem??

Many thanks in advance.

Doug

You'll probably find you can use the text box's Value property, rather
than its Text property, and it will work. The help topic on Access
specifications says that the maximum number of characters in a text box
is 65535, but that doesn't seem to be true when you set the value from
code.

I find that setting the Text property maxes out for me at 2048
characters. Although the Text property is not undocumented -- you'll
find it described in the help file, under "Properties" in the section
"Microsoft Access Visual Basic Reference" -- I don't see anything in its
help-file entry that states this maximum.

It's well known that the help system is broken. Despite this
counterexample, almost all the content you would want is actually in
there, but it's very hard to find. If you know the name of the
property, method, object, or keyword you want to look up, it's usually
easiest to type it in the Immediate Window or a code window, then
position the text cursor on or adjacent to the word and press F1.
 
D

Doug

The .value property works. Thanks!


Dirk Goldgar said:
You'll probably find you can use the text box's Value property, rather
than its Text property, and it will work. The help topic on Access
specifications says that the maximum number of characters in a text box
is 65535, but that doesn't seem to be true when you set the value from
code.

I find that setting the Text property maxes out for me at 2048
characters. Although the Text property is not undocumented -- you'll
find it described in the help file, under "Properties" in the section
"Microsoft Access Visual Basic Reference" -- I don't see anything in its
help-file entry that states this maximum.

It's well known that the help system is broken. Despite this
counterexample, almost all the content you would want is actually in
there, but it's very hard to find. If you know the name of the
property, method, object, or keyword you want to look up, it's usually
easiest to type it in the Immediate Window or a code window, then
position the text cursor on or adjacent to the word and press F1.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top