Private DBEngine Problem

A

Alan B. Densky

I'm trying to create a private dbengine in A 97 without success. I've tried
two different methods but get the same error with both. Can someone please
set me straight?

Try # 1
Dim db As Database
Dim rst As Recordset

Dim dbe As New DBEngine
Set db = dbe(0)(0) 'Error 3265 Item not found in this collection

'*******************************************************
Try # 2

Dim db As Database
Dim rst As Recordset
Dim dbe As DBEngine
Set dbe = CreateObject("DAO.DBEngine.35")
Set db = dbe(0)(0) 'Error 3265 Item not found in this collection
 
D

Douglas J. Steele

You've create a new DBEngine. It doesn't have any workspaces or databases in
it until you add them. And actually, the help file states "You can't create
additional DBEngine objects", so I'm not sure you're going to be able to do
anything this way.
 
D

david epsom dot com dot au

Also, if you want a 'private dbengine' then you were probably
thinking of
dim pdbe as DAO.PrivDBEngine
set pdbe = new DAO.PrivDBEngine

rather than a dbEngine object

(david)
 
G

Geoff

Try creating a new PrivDBEngine. This additionally
allows you to use a customised workgroup (mdw) file
(for databases that have user-level security enabled),
a different username, and a different password to
open a secured database. By default Access uses
using the system.mdw, logging in as the admin user
with no password. Here's how:

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"
dbe.DefaultPassword = "Password"

Set wrk = dbe.Workspaces(0)
Set dbs = wrk.OpenDatabase("C:\Samples\Secured Northwind.mdb")

Good luck with your project.
Geoff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top