ah just did a double check and that changed at some point from 3 to 7. 3 was the old limit for nested forms.
BTW, the other way (non-nested) is just a limit on resources available; I'm not aware of any limit there other then 754 controls over the lifetime of a form (which I'm thinking as I'm saying that, has changed as well to over 1200).
So the current limit is not as high as I was thinking (1200), but it's 1040 which is well above the published spec.
Code that was used to check this is below. Control type didn't seem to make a difference (I only tested labels and text controls though) as I got the same numbers each way. This code was also run on multiple machines and verified by different people. All got the same numbers.
So apparently the control creation limit is not a hard limit, but based on some other internal constraint. This is similar to the table ID limit, which is stated as 2048, but actually floats a bit.
These limits are somehow tied to the way Access internally handles open objects, but what that process is is un-clear.
Jim.
Public Sub CheckControlCreation()
Dim frm As Form
Dim ctlText As Control
Dim ctlLabel As Control
Dim intK As Integer
' Create form based on Customers form.
Set frm = CreateForm()
For intK = 1 To 2000
' Create unbound default-size text box in detail section.
Set ctlText = CreateControl(frm.Name, acTextBox, acDetail, , , 100 + intK, 100 + intK, 200, 200)
' Create child label control for text box.
Set ctlLabel = CreateControl(frm.Name, acLabel, , ctlText.Name, "", 100, 100)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
How funny ... imagine - a spec that Microsoft has wrong. I wonder how many others of off ?
Interesting difference between A2002 and A2003 .... one control.
mx
Jim Dettman (EE MVE)
I think the spec was written at the time of A95/A97 (that's when it first appeared), and has simply been carried forward without anyone really checking it.
Meanwhile, the process that's involved with the limit has evolved over time and allows more. Whether that's by design or just a by-product of other changes is hard to say.
Seems strange too that it's gone up in every release, so my guess it's a result of something else.
and the really weird part; no where did we come up with 754!