How do I copy a string buffer of more than 255 characters into an Access 2003 TextBox

Posted on 2009-04-16
Medium Priority
Last Modified: 2013-11-28
I have a situation where I am reading text from several Access database memo fields into several VBA strings.  Then, depending on other conditions, I am setting the an unbound TextBox.Value to one of the VBA strings for user edit.

All works fine as long as the original string is 255 characters or less.  However, if the string buffer I am attempting to copy is longer than 255 characters, strange things happen ... usually it just truncates the text in the textbox to 255 characters.

This is not a problem with a bound textbox ... only when attempting to set a TextBox value directly from a string longer than 255 characters.

I have found other solutions for Excel, but the outlined methods and functions (i.e. Character and Insert) are not available in Access VBA.

Does anyone know a work around?
Question by:JamesRidenour
  • 3
LVL 65

Expert Comment

ID: 24163514
textboxes do have a limit of 255 chars, no getting round this. This is just for unbounded right? Not sure but how about using a rich textbox control. Not sure the limit of that but I assume it would be more.


Accepted Solution

Joe Overman earned 750 total points
ID: 24163582
Someone help me out here,  I just add 13000 chars to an unbound text box (see example)


Author Comment

ID: 24163615
Yes ... this is for an unbound text box. A textbox that is bound to a memo field can go to 65k characters ... I know that work.  The only problem is the copy of the data from the VBA string INTO the TextBox.  It does not seem to have a problem going the other way (ie. copying the data from the TextBox to the VBA string) .
I figured since there was a solution for this in other Office applications there would be one for Access as well.

Author Comment

ID: 24163697
masterjojobinks - thanks ... that's interesting.  It certainly works.  I converted to 2002-2003 format and it still works.
I can see no difference between our code and TextBox controls other than I am using ADO to read in the string from a memo field in the database.

Author Comment

ID: 24163990
I found the problem ... It was with the query that was reading the memo field data.
I was using a calculated field in the query to return back the memo data as follows:
iif(IsNull([MemoA]), [MemoB], [MemoA)
The query only reliably returned the first 255 characters of the MemoA or MemoB fields.
Dumb mistake!  Thanks to all that replied.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question