RE: Create Object Error - 29054

The problem will return.
Dave Hargis, Microsoft Access MVP

"Rod" wrote:

I have no idea why but when I call the procedure from a different form it
works just fine! Problem solved. I didn't change anything! Anyway, thanks for
your help.

"Klatuu" wrote:

I would first try a compact and repair, but I'm not sure that will do it. If
that does not work, try copying the form to another mdb.
Dave Hargis, Microsoft Access MVP

"Rod" wrote:

So you're saying that since I've run this code over and over a bunch of
times, each time creating temporary controls, that I have hit the lifetime
limits of controls for this form?

How aggravating! Is there any way to reset the 'control count'?

"Klatuu" wrote:

There is a lifetime limit of 754 controls on a form. That means every time
you add a control to a form, the count increases by one, but when you remove
a control, the count does not descrease. You have hit the limit.

I would suggest you consider changing your design to create a temporary
table that would contain a row for what is now an element of your array and
create a form (or subform as the case may be) in continuous or datasheet view.
Dave Hargis, Microsoft Access MVP

"Rod" wrote:

This is my code on the Open procedure of an Access form:

Sub FlagAnalysis()
Dim DBA As Database
Dim FlagSet As dao.Recordset
Dim rcnt, i, boxTop As Integer
Dim ctlLabel, ctlText As Control
Dim FlagRay(), CtlNameRay()
Dim FlagDef As QueryDef
Dim FlagField As Object
Set DBA = CurrentDb
Set FlagSet = DBA.OpenRecordset("qry_FlagAnalysis-Count_02")

'Thow Positive Flags into an Array
i = 0
With FlagSet
For Each FlagField In FlagSet.Fields
If FlagField.Value > 0 Then
i = i + 1
ReDim Preserve FlagRay(2, i)
FlagRay(1, i) = Right(FlagField.Name, Len(FlagField.Name) -
(InStr(1, FlagField.Name, "of") + 1))
FlagRay(2, i) = FlagField.Value
End If
Next FlagField
End With

'Open Form and Create Controls
DoCmd.OpenForm "frm_FlagAnalysis", acDesign
boxTop = 500
For i = 1 To UBound(FlagRay, 2)
Set ctlText = CreateControl("frm_FlagAnalysis", acTextBox, acDetail, "", ,
100, boxTop, 1000, 250)

And that's where it dies. It says "Microsoft can't add, delete or rename the
control(s) you requested. Funny thing is that this WAS working just fine. I
don't know what happened. Any suggestions? Thanks in advance.