[AccessD] Form Lifetime Control Limit (Was: Advice on A2010....)

Kenneth Ismert kismert at gmail.com
Thu Dec 8 17:15:30 CST 2011


>
> Heenan, Lambert:
>
> Regarding the (crazy) form control limit. Do you know if the count gets
> reset if you make a copy of the form? Does the new copy have a controls
> count equal to the number of controls currently on the form? What about
> importing the form into another MDB file?
>
> Jim Dettman:
>
> 3. Access is limited to 754 controls over the life of a form, so watch how
> big you get (note the limit is not 754 - deleting and creating a control
> does not decrement/increment the count, it only increments it).  Surprised
> you didn't run into that one.
>

There is one moderately sneaky way around this limit.  Steps:

1. Rename all form controls with a default numeric suffix, like 'label123'
and 'text234'.

2. Count the number of controls on your form. With the form in design view,
enter this in the Immediate window:
    ? Forms("frmFoo").Controls.Count

2. Save the form as text, using this command:
    Application.SaveAsText acForm, "frmFoo", CurrentProject.Path & "\" &
"Form_frmFoo.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. Backup your Access file. Delete the problem form. Compact & Repair.

5. Import the form using:
    Application.LoadFromText acForm, "frmFoo", CurrentProject.Path & "\" &
"Form_frmFoo.txt"

You should now be able to add new controls to your previously 'stuck' form.

It is a little work, but probably less than copying all the controls, code
and properties over to a new form.

-Ken



More information about the AccessD mailing list