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
.MoveFirst
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.
.



Relevant Pages

  • RE: Non-editable field
    ... use a SetFocus is if you want the user to work with a specic control. ... Dim rs As Recordset ... Part of your problem may be that unlike VB, VBA only recognizes the Text ... Dave Hargis, Microsoft Access MVP ...
    (microsoft.public.access.forms)
  • RE: Non-editable field
    ... use a SetFocus is if you want the user to work with a specic control. ... Dim rs As Recordset ... Dave Hargis, Microsoft Access MVP ... You can still populate the controls programmatically. ...
    (microsoft.public.access.forms)
  • RE: Calender report conversion.
    ... I found that I had to set my control heights to a very low number prior to ... Microsoft Access MVP ... "Duane Hookom" wrote: ... Dim lngTopMargin As Long ...
    (microsoft.public.access.reports)
  • Re: Step through code?
    ... Doug Steele, Microsoft Access MVP ... in Rock Hill, SC ... ' Find the record that matches the control. ... Dim rs As Object ...
    (microsoft.public.access.forms)
  • RE: Convert Excel function to Access Query
    ... Microsoft Access MVP ... "Rod" wrote: ... "Duane Hookom" wrote: ... Dim rs As DAO.Recordset ...
    (microsoft.public.access.queries)