[AccessD] Form Lifetime Control Limit -- Final Recommendation

Kenneth Ismert kismert at gmail.com
Thu Dec 15 17:08:13 CST 2011


Here is my proposal for how to best fix Form Control Limit problems:

Control Limits
===========
Access imposes limits on how may controls you can put on a form or report:
A97 - 753
A2000 - 800
A2002 - 894
A2007 - 1040
A2010 - 1040
Thanks to Jim Dettman for working out these limits.

If you try to add more controls than your version of Access allows, you
will see:
Error: 29053
<database> can't create any more controls on this form or report.

At this point, check the number of controls on the form:
? forms("Form1").Controls.Count

If that number is less than the stated limit, you can still add more
controls, but you have to reset the control counter. Here's how:

Access 2000 or Later
=================
If you CREATED the form in Access 2000 or later, follow these steps:
Application.SaveAsText acForm, "Form1", CurrentProject.Path & "\Form_Form1"
Application.LoadFromText acForm, "Form1", CurrentProject.Path &
"\Form_Form1"

This should reset your control list, allowing you to keep adding up to the
stated limit. Notes:
  * This is a lot easier than copying the controls to a new form, and
manually changing all form properties to match the old
  * EatBloat will also reset the counter for such forms, as it uses this
basic technique

Access 97
========
If the form was created in Access 97, and you imported it into a later
version, there is more work to do. Follow these steps:

1. Rename all form controls with a default numeric suffix, like 'label123'
and 'text234'. This eliminates all possibility of name collisions.

2. In the Immediate window, count the number of controls:
? Forms("Form1").Controls.Count

2. Save the form as text:
Application.SaveAsText acForm, "Form1", CurrentProject.Path &
"\Form_Form1.txt"

3. Edit "Form_frmFoo.txt" using a text editor. Find this attribute, and
edit it to the number of controls +1:
ItemSuffix =128

4. Import the form using:
Application.LoadFromText acForm, "Form1", CurrentProject.Path &
"\Form_Form1.txt"

-Ken



More information about the AccessD mailing list