Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
The following function circumvents both these problems. It returns [purple]0[/purple] if the recordset is closed/does'nt exist, and a [purple]number > 0[/purple] representing the number of open instances found.[blue]Definition : Multiple Instances
More than one recordset object having the same source.[/blue]
[blue]Public Function IsOpenRst(rstSource As String) As Integer
[green]'Return = 0 = rstSource not open/exist
'Return > 0 = # of open instances of rstName
'rstSource is the same Source in db.OpenRecordset(Source, Type)[/green]
Dim ws As Workspace, db As DAO.Database, rst As DAO.Recordset
Set ws = DBEngine.Workspaces(0) [green]'Default WorkSpace[/green]
For Each db In ws.Databases
For Each rst In db.Recordsets
If rst.Name = rstSource Then [green]'rst.Name returns the Source![/green]
IsOpenRst = IsOpenRst + 1
End If
Next
Next
Set ws = Nothing
End Function[/blue]
Microsoft said:[blue]Several object variables can refer to the same actual object. When Nothing is assigned to an object variable, that variable no longer refers to an actual object. When several object variables refer to the same object, [purple]memory and system resources associated with the object to which the variables refer are released only after all of them have been set to Nothing[/purple], either explicitly using Set, or implicitly after the last object variable set to Nothing goes out of scope.[/blue]