Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 210172 - Last Review: June 24, 2004 - Revision: 2.0
ACC2000: Invalid Length for Fixed-Length String - Exceeds 64-KB Limit
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).
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
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.
Do not declare fixed-length strings longer than 65,535 bytes.
Steps to Reproduce Behavior
- Start Microsoft Access and open any database or project.
- 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.
- 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.
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.
APPLIES TO
- Microsoft Access 2000 Standard Edition
| kberrmsg kbprogramming kbprb KB210172 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate