No one? I've spent some more time testing my code, and it seems that the object of clsFilter is properly set on newly created subform but then somehow disappears. Analyze this short code:
Code:
Private newFil As clsFilter
Private Sub btnChoose_Click()
Debug.Print TypeName(newFil)
Call newFil.updateItem(Text0.value) 'I got error "Object variable or With block variable not set". If test debug.print TypeName(newFil) it returns Nothing
End Sub
Private Sub Form_Open(Cancel As Integer)
Set newFil = factory.filter
DoEvents
Debug.Print TypeName(newFil) 'this test returns "clsFilter" which proves that newFil (instance of clsFilter) exists here and is set correctly
End Sub
What's going on? Do I have to save the added module first or what? It doesn't seem so as Form_Open event triggers without issues.
Robert