PRA: MsgBox Function Shows Only First 512 Characters

    Article ID: Q142732
    Creation Date: 17-JAN-1996
    Revision Date: 20-SEP-1996

    The information in this article applies to:

    • Microsoft Access version 2.0

    SYMPTOMS

    Moderate: Requires basic macro, coding, and interoperability skills.

    When you try to display more than 512 characters in a message box by using the MsgBox() function, the box sizes itself to be big enough to display all of the characters you entered, but it only displays the first 512 characters. This is contrary to online Help, which states that the Msgbox() function can display 1024 characters.

    STATUS

    This behavior no longer occurs in Microsoft Access for Windows 95 version 7.0. In Microsoft Access 7.0, you can display approximately 1024 characters by using the MsgBox() function.

    MORE INFORMATION

    Steps to Reproduce Problem

    1. Create a module and type the following line in the Declarations section:

            Option Explicit
      
    2. Type the following procedure.

      NOTE: In the following sample code, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.

            Function MBLT ()
               Dim z As String
      

               'Create a string with 1024 characters:
               '500 a's, the words "Next Line", and 512 b's.
               z = String(500, "a") & Chr(13) & Chr(10) & "Next Line" & _
                    String(512, "b")
      

               MsgBox z                       'Display the String.
      

            End Function
      
    3. To test this function, type the following line in the Immediate Window, and then press ENTER.

             ? MBLT()
      

      Note that when the message box opens, it is big enough to display 1024 characters. However, it displayes only the 512 a's. No b's, are displayed.

    4. Press ENTER to close the message box.

    REFERENCES

    For more information about the Msgbox() function, search for "Msgbox," and then "Msgbox Function, Msgbox Statement" using the Microsoft Access Help menu.


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
©1997 Microsoft Corporation. All rights reserved. Legal Notices.

Additional reference words: 2.00
KBCategory: kbusage kbdocerr
KBSubcategory: GnlApp