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

Form field character limit

Status
Not open for further replies.

strantheman

Programmer
Mar 12, 2001
333
US
I made a custom form with unbound text boxes. There's a SAVE button that executes a query which performs a SQL insert statement.

One of the textboxes on my form "pictured" will be used to enter a list of names. The corresponding field in my table has been set to type MEMO to allow for the length of the entry. The insert statement worked fine until I tried to enter more than 128 characters into the "pictured" textbox. The form didn't even execute the query, it just stopped, and threw a "Invalid Argument" error dialogue at me.

I tested the form over and over to pin point that it was this single field causing the error. I also hypothesized that the amount of characters had something to do with the problem. I discovered that the SAVE button works fine when using 128 characters or less, but as soon as I enter the 129th character into the "pictured" field my form stops cold. I have been unable to find any property related to a textbox that would allow me to increase some sort of limit. Does anyone know why im receiving this error or possibly another option for me?

 
Your form I hope is bound to your table. A text box will accommodate a memo field. I have a suspicion you are using Unicode text as it is taking only 128 characters and each Unicode character takes two bytes. A normal text field will hold 255 bytes from byte 0.

My suggestion is to bind your text box to your memo field so access will expect a memo rather than a text string. As a form design suggestion, make the text box deeper than just one line. That way the user will be able to see the lines he has typed.
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Hi thornmastr

What do you mean im using Unicode? I dont think ive changed anything from the default textbox.

Like I said, these are all unbound textboxes and an unbound form. The query im executing performs some concatenation on some of the form fields to create values for some of the table fields, so I do not want to use Access's built in system. Sure, I could use the wizard and make a totally new form and have all the fields bound, but everything works great except for this one part.

Binding the field would be a good solution if I was trying to have Access do a multitude of things for me, but I dont want its automated procedures anywhere in between my form and query. Thats not the best solution in my case.

So what do you mean by Unicode? And have you ever created a form the way im doing, non bound?
 
Let’s take care of the Unicode thing. If you do international type programming Unicode allows you to ignore linguistic differences. It allows you to treat Chinese, Japanese, Swahili, Arabic, etc, all the same. So Unicode, for a lot of people is very worthwhile. But if you don’t need it; don’t use it as it is expensive. Under Unicode it takes two bytes to hold one character. So now, the text string limit with Unicode is 256/2 = 128. The Unicode fonts are also expensive to use as well.

Now, if you are using A2K or above, Unicode is a part of your font selection. Check the font you are using in your text box. Most developers who use Unicode use ARIEL UNICODE MS font. If you check and that is your default font, change it.

Again, the reason I mentioned it at all was because of your character limit of 128.

I do use unbound forms but only under very specific constraint, i.e.
very large complex record structures;
Situations which demand updates of multiple tables from one form.

And, in all cases, I ONLY use unbound forms with my own defined clases. If I can’t justify developing classes for a project I have no reason to use unbound forms.

Now, specifically, to your problem. A textbox can easily accommodate what you put into a memo field. If I remember correctly, using only a textbox, you should be able to input more than 2000 characters into an unbound text field

I just created an unbound form with one text box. I made the box about three inches tall, and then copied this answer into the text box more than 3 times before it stopped, which I think is a little over 2000 characters; certainly not 128.

My suggestions to you, given that you are insisting on an unbound form:
Make sure your text box does not have a Unicode font,
Make it larger than just one line.

It should work.
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Thanks for the reply.

My problem isnt getting the textbox to hold the text, its getting passed the form submit. Sure it will hold a lot of text, but it still throws "Invalid Argument" error when I click SAVE.

Yes I checked, and all my textboxes are using the default MS sans serif. Im not having display issues, im having submit issues.

Everything works great except when I enter more than 128 characters into a textbox. Is there anything else I can look at?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top