peebatron10k
Programmer
I am trying to write a class module which will create a series on controls on any given form with the end result being a menu. the class is called on the load event of a form:
Private Sub Class_Initialize()
Dim initFrm As String
Dim X As Integer
Dim p(1 To 17) As Control
'kill instance if parent not form
If Application.CurrentObjectType <> acForm Then
Class_Terminate
End If
initFrm = Application.CurrentObjectName
'enter design
DoCmd.OpenForm initFrm, acDesign
For X = 1 To 17
Application.CreateControl initFrm, acLabel, acDetail, , , , 56 + (X * 226), , 223
appFormat X, initFrm
appLbl X, initFrm
appEvent X, initFrm
Next X
'enter normal
DoCmd.OpenForm initFrm, acNormal
End Sub
(appFormat, appLbl and appEvent are seperate Subs within the class)
The first time it hits the CreateControl method it tells me that: "Microsoft Access can't add, rename or delete the controls you requested" (this is err code 29054)
I would normally try and figure this one out but the error message doesn't give away any clues as to what is the problem and the Debug button is disabled.
Does anyone know where I am going wring? Any help is greatly appreciated
peebatron10k
Private Sub Class_Initialize()
Dim initFrm As String
Dim X As Integer
Dim p(1 To 17) As Control
'kill instance if parent not form
If Application.CurrentObjectType <> acForm Then
Class_Terminate
End If
initFrm = Application.CurrentObjectName
'enter design
DoCmd.OpenForm initFrm, acDesign
For X = 1 To 17
Application.CreateControl initFrm, acLabel, acDetail, , , , 56 + (X * 226), , 223
appFormat X, initFrm
appLbl X, initFrm
appEvent X, initFrm
Next X
'enter normal
DoCmd.OpenForm initFrm, acNormal
End Sub
(appFormat, appLbl and appEvent are seperate Subs within the class)
The first time it hits the CreateControl method it tells me that: "Microsoft Access can't add, rename or delete the controls you requested" (this is err code 29054)
I would normally try and figure this one out but the error message doesn't give away any clues as to what is the problem and the Debug button is disabled.
Does anyone know where I am going wring? Any help is greatly appreciated
peebatron10k