Error #91 when calling a procedure containing custom objects

FizzyFish

Registered User.
Local time
Today, 09:23
Joined
Jun 16, 2006
Messages
26
I have a main form with several sub forms, but they are handled as objects. So first the forms are declared at the module level (they already exist on the form at this point as sub forms but have no parent child relationship).

Option Compare Database
Option Explicit

‘Module Level Variables
Private m_frmCase As Form_frmCase
Private WithEvents m_frmMyCORE As Form_frmMyCORE


When the form opens I set the sub forms to the variables so that I can manage the procedures and capture events on the sub forms.

Private Sub Form_Open (Cancel as Integer)
'Equate with local member to create link to methods, properties and events (Initialize sub forms)
Set m_frmMainMenu = Me.sfMainMenu.Form
Set m_frmMyCORE = Me.sfMyCORE.Form
End sub

One of the events captured is when ObjectSelected is fired up on the MyCore form. At this point I am trying to load the Case sub form by passing the object type and the object ID.

Private Sub m_frmMyCORE_ObjectSelected(ByVal ObjectType As COREObjectType, ByVal ObjectID As String, ObjectParentModuleType As COREObjectType)
On Error GoTo suberror

DoCmd.Hourglass True

Select Case ObjectParentModuleType
Case COREObjectType.cotCase
'Load
If LoadCOREModule(COREModule.Cases) Then
m_frmCase.LoadObject ObjectType, ObjectID *****
'Update mainmenu
m_frmMainMenu.SetModuleFocus COREModule.Cases
End If

End Select

DoCmd.Hourglass False

Exit Sub
suberror: DoCmd.OpenForm "frmWizard_ReportBugs", acNormal, , , , acDialog, Err.Number & "|" & Err.Description & "|" & Me.Name & ".m_frmMyCORE_ObjectSelected"
End Sub

It is at the point highlighted above (*****) that I am receiving an error number 91 message. As you can see the parameters are in the LoadObject procedure in the Case form defined exactly the same as they were in the originating procedure that is calling it.

Public Sub LoadObject(ByVal ObjectType As COREObjectType, ByVal ObjectID As String)
On Error GoTo suberror

m_frmShare_ObjectTree_ObjectDblClick ObjectType, ObjectID, COREObjectType.cotFolder, "1"

Exit Sub
suberror: DoCmd.OpenForm "frmWizard_ReportBugs", acNormal, , , , acDialog, Err.Number & "|" & Err.Description & "|" & Me.Name & ".LoadObject"
End Sub

This error just started happening the other day and if I go back to an earlier version the error does not occur, however I cannot find any differences between the two versions in the code above. The only things I have changed are code in other forms that are not being called at the time the above procedure is called.

I am really stumped on this and would appreciate any help.
 

Users who are viewing this thread

Back
Top Bottom