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

Posted on 2009-04-20
Last Modified: 2013-11-27
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

Question by:StepCart
    LVL 1

    Author Comment

    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.
    LVL 84

    Accepted Solution

    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
    LVL 1

    Author Comment

    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?
    LVL 1

    Author Closing Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now