[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 468
  • 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, _
            Exclusive:=False
        mappMSAccSource.DoCmd.TransferDatabase _
            Transfertype:=acExport, _
            databasetype:="Microsoft Access", _
            DatabaseName:=strDestinationFileName, _
            Source:=mappMSAccSource.CurrentDb.TableDefs(15).Name

Open in new window

0
StepCart
Asked:
StepCart
  • 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.
0
 
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
0
 
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?
0
 
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.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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