Using a Different Workgroup Information File

As an example, you may have some data in a secured copy of the Northwind database that uses a different workgroup information file than your user may be using by default. To open this database, you can use code such as the following fragment:

Dim dbe As PrivDBEngine
Dim wrk As Workspace
Dim dbs As Database

Set dbe = New PrivDBEngine
dbe.SystemDB = "C:\MyApp\MyWorkgroupFile.mdw"
dbe.DefaultUser = "SecureUser"
Set wrk = dbe.Workspaces(0)
Set dbs = wrk.OpenDatabase("C:\Samples\Secured Northwind.mdb")

Without the PrivDBEngine object, you would have to start another instance of your application or Microsoft Access in order to access a database that uses another workgroup information file. Creating a PrivDBEngine object is significantly faster.