Rory(Lounge moderator) told me that if one declares Public cat as New ADOX.catalog in a standard module in an Access 2000 project, then you one mustn't use set cat = nothing in any module's(standard or class)procedure "otherwise once you've run the procedure the public instance of the catalog will be destroyed and you won't be able to reference it in any procedure unless you create a new instance of it."
Does the same philosophy(pun intended) work for all object variables declared as public?
Because in the same module I've also declared Public rst as New ADODB.Recordset and use rst in two class modules associated with two reports: Report1 and Report2.
In Private Sub Report_Close() for Report1 I put
set rst = Nothing
I opened and closed Report1 and opened Report2 immediately afterwards.
According to what you say, since the Private Sub Report_Open(Cancel as Integer) for Report2 contains code such as
rst.Open("Select Table.Id, ....
I was expecting an error message telling that rst doesn't exist but, to my surprise, Sub Report_Open runs normally even though I didn't create a new instance of rst.
Can anyone explain why?