• Trouble with copyobject and password (2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Trouble with copyobject and password (2000)

    Author
    Topic
    #373170

    I was having trouble using transferdatabase to export some tables to a non-user-level-password protected database – I would provide the password when prompted, but the tables wouldn’t export. I found an answer in Francois’s May 15 post to Aral where he suggested using the copyobject method, and provided the following code sample with which I can now get the tables to export. However, I am still prompted for the password. Anyone know why?

    Thanks,

    Randy

    Sub CopyTable()
    Dim db As DAO.Database
    Dim ws As DAO.Workspace
    Dim rst As DAO.Recordset
    Set ws = DBEngine.Workspaces(0)
    Set db = ws.OpenDatabase(“C:protecteddb.mdb”, False, False, “MS Access;PWD=secret”)
    DoCmd.CopyObject db.Name, “table1”, acTable, “table1”
    db.Close
    End Sub

    Viewing 0 reply threads
    Author
    Replies
    • #598937

      I suspect that the destination database is in Access 97 format.
      I re-test the code with an Access 2000 destination database and it works.
      When I test it with an Access 97 destination database, I get also the prompt for the password.
      I don’t know how you can tell you want to copy to a 97 database.
      Maybe somebody else ?

      • #598942

        Francois,

        I thought you had something there, since I was testing it on an old database, but I checked it and it was an Access 97 database that I had already converted to Access 2000. I created a new, empty Access 2000 database using the same name and password — it still prompted me for the password. At least it is sending the objects into the destination database. The transferdatabase method also prompted for the password, but the objects never made it to the destination database.

        I just thought of something – the database that I’m running this from was converted from Access 97 – I’ll try the function in a ‘virgin’ Access 2000 database going to an Access 2000 database and see if that has any effect, although I don’t know why it would.

        Thanks,

        Randy

    Viewing 0 reply threads
    Reply To: Reply #598942 in Trouble with copyobject and password (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel