Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Oct 29, 1998

Close All Open Recordsets and Databases

This small subroutine iterates through and closes all databases in the Databases collection of the Workspaces object. For each database in the collection, it iterates through each Recordset and closes it first:

 Public Sub DBCloseAll()
Dim DBInstance As Database
Dim RSInstance As Recordset
On Error Resume Next
	For Each DBInstance In Workspaces(0).Databases
'For all open databases....
			For Each RSInstance In DBInstance.Recordsets
'For all open=20
Recordsets....
				RSInstance.Close 
			'Close all Recordsets
			Next
	DBInstance.Close 
	' Close DB
 Next
End Sub
Marcus Cedergren
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date