• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 472
  • Last Modified:

Getting Workspaces SystemDB DoCmd.TransferDatabase and Application Object to work together

I am at the edge of my understanding here and I don't know how to accomplish what I need to do. Basically I am trying to take a secured database and unsecure it programatically. This means I need to export all the object into a database with default access security. I am trying to do it in a VB application. I have no problem creating a secured workspace, but I can't seem to append it the current application object nore can I seem to create a new application object and change the systemdb file and log into it in order to run docmd in the log in user.

The code below is one version of what I have tried, which doesn't work of course.
Set mappMSAccSource = New Application
        mappMSAccSource.Visible = True
        mappMSAccSource.DBEngine.SystemDB = txtSecurityFile
        Set mwsSecure = mappMSAccSource.DBEngine.CreateWorkspace("SecureSource", gstrDBOwnerAccount, gstrDBOwnerPwd, dbUseJet)
        mappMSAccSource.DBEngine.Workspaces.Append mwsSecure
        mappMSAccSource.OpenCurrentDatabase _
            filepath:=strSourceFilename, _
        mappMSAccSource.DoCmd.TransferDatabase _
            Transfertype:=acExport, _
            databasetype:="Microsoft Access", _
            DatabaseName:=strDestinationFileName, _

Open in new window

  • 3
1 Solution
StepCartAuthor Commented:
Is there a way to get back to the application object of the workspace or database object? I don't see any kind of parent property.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You should:

1) Log on as a member of the Admins group
2) Restore ALL permissions for the database and all objects to the Users group
3) Clear the logon password for the Admin user. Place the Admin user back in the Admins group, if need be
4) Close your current instance of Access
5) Open a new instance of Access, with the default system.mdw file
6) Create a new, blank database
7) Import everything from the old to the new
StepCartAuthor Commented:
Thanks for your Response LSM.

You confirmed what I had partially figured out since I posted. But I am having a little problem with the dbengine.

At my login I am setting up a private db engine to check the users password (making sure they create a new one if it is blank and such) some how that seams to set the dbengine of the implicit application object to the default systemdb (...\userslocaldirectory\...\system.mdw). After that every instance of a new access.application that I set seams to have the dbengine set to the default mdw and I can't seem to change it. The reason I need to do this is I do not want to change any of the settings for 'admin' on the network copy of the mdw because it will be in use by other users so I want to create a copy of it and then make the setting changes to it and then destroy it after I have the copy of the database with default security.

Any ideas?
StepCartAuthor Commented:
I guess I was having difficulty letting go of how I envisioned it working. I see your steps don't require me to use the pesky dbengine. Thanks so much for your help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now