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

Posted on 2009-04-16
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
    LVL 65

    Expert Comment

    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.
    LVL 8

    Accepted Solution

    Someone help me out here,  I just add 13000 chars to an unbound text box (see example)


    Author Comment

    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

    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

    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

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
    In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
    Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    733 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now