Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Invalid Length for Fixed-Length String - Exceeds 64-KB Limit


View products that this article applies to.

This article was previously published under Q210172
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

↑ Back to the top


Symptoms

When you declare a fixed-length string variable that is larger than 65,535 bytes, the following message appears:
Compile error:

Invalid length for fixed-length string

↑ Back to the top


Cause

Variables in Microsoft Access 2000 are limited to approximately 64 KB per fixed-length string, regardless of whether the variables are local or global. The error message appears if a fixed-length string exceeds that limit.

This is not a cumulative total. In other words, variable X and variable Y can each be approximately 64 KB in size. The exact maximum length of a fixed-length string in Microsoft Access 2000 is 65,535 bytes.

↑ Back to the top


Resolution

Do not declare fixed-length strings longer than 65,535 bytes.

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Start Microsoft Access and open any database or project.
  2. Create a module and type the following lines in the Declarations section:
    Option Explicit
    Global x as String * 66000
    						
    You then see the following error message:
    Compile error:

    Invalid length for fixed-length string
    NOTE: The error message appears only if you type the code, not if you cut and paste it into the code window.

  3. Click OK, and then change the string length to 65535; this is the maximum allowable length.
This limit also applies to fixed-length strings declared within procedures, and the same message appears if it is exceeded.

↑ Back to the top


References

For more information about the String data type, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type string data type in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB210172, kbprb, kbprogramming, kberrmsg

↑ Back to the top

Article Info
Article ID : 210172
Revision : 2
Created on : 6/24/2004
Published on : 6/24/2004
Exists online : False
Views : 362