Assign a workgroup to a workspace object - Thanks to Paul Overway

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Thanks Paul Overway, your solution did and didn't help me - believe me, after
hours of reading and experimenting I would have created a new workspace with
a specific workgroup if I could fine the correct syntax or a relevant
example somewhere! Can you give me a sample please of linking to tables in a
backend database that has a specific workgroup from within a frontend
database that does not have it's own specific workgroup. Or if anyone else
can, I would really appreciate it! Thanks - Jenny
 
Paul, are you sure that you *can* link to a secured db from an
unsecured one, just by creating the link from a suitable workspace?
I've never tried that myself. Are you sure that it is possible?
(without playing special PID tricks)

Cheers,
TC
 
I'm sorry...it has been awhile since I did something like that. You DO need
to work in a 2nd workspace, but you also need to instantiate another
DBEngine object first. So, you'd do something like this (air code)

Dim dbe as New DbEngine
Dim wrk as Workspace
Dim db as database

dbe.SystemDB = "path to workgroup file here" 'you'll either have to
hard code it or prompt from the user.
Set wrk = dbe.CreateWorkspace("SecureWorkspace","user name here",
"password here")
dbe.Workspaces.Append wrk

Set db = wrk.OpenDatabase(currentdb.name)

'ok....relink tables or do whatever now
 
PS....just to clarify...you need to relink using the db object from below,
don't use currentdb or another db object because currentdb was opened in the
"unsecure" workspace
 
Just to clarify some things about opening a secure database from within an
unsecure database...my air code posted earlier would never work in Access
(although it works in VB just fine). The following code WILL work...

Dim dbe as New PrivDbEngine 'NOTE this object is not documented in
Access, but is documented elsewhere
Dim wrk as Workspace
Dim db as database

dbe.SystemDB = "path to workgroup file here" 'you'll either have to hard
code it or prompt from the user.

Set wrk = dbe.CreateWorkspace("SecureWorkspace","user name here", "password
here")

dbe.Workspaces.Append wrk

Set db = wrk.OpenDatabase(currentdb.name)
'ok....relink tables or do whatever now


If anyone is interested in documentation for PrivDBEngine see

http://www.microsoft.com/resources/documentation/sql/7/all/proddocs/en-us/msjet/jetch02.mspx

(it IS there...just way down the page!)
 
Back
Top