Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Feb 2002
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trouble with copyobject and password (2000)

    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("Crotecteddb.mdb", False, False, "MS Access;PWD=secret")
    DoCmd.CopyObject db.Name, "table1", acTable, "table1"
    db.Close
    End Sub

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Trouble with copyobject and password (2000)

    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 ?
    Francois

  3. #3
    Star Lounger
    Join Date
    Feb 2002
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Trouble with copyobject and password (2000)

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •