Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2006

    Unanswered: help needed with CompactDatabase

    I am using the CompactDatabase function to create a backup and it will not work if the server side db has a password. Here is the scenario...

    (Client-Server setup with password on server mdb.Access 2003 on Windows2003 server XP user machines.)

    I have inserted the following line of code, into a function on the Client side, to create an automated backup on exit. The strData and strBkp are string variables which hold the path/name to the mdb file and the path/name of the backup file i wish to be created. Obviously the password is the real thing in the real code.

    DBEngine.CompactDatabase strData, strBkp, , "password"

    This will generate an error 3421 'Data type conversion error'

    DBEngine.CompactDatabase strData, strBkp, "password"

    This one generates an error 3031 'not a valid password' - although it IS the correct one!

    This, and the rest of the associated code, works fine if I remove the password from the backend database ( and don't include the password bit on the compactdatabase function obviously)

    I would be grateful for any help as I really don't want to leave the password off the server mdb file.


  2. #2
    Join Date
    Jun 2006

    fixed it!! (compactDatabase with password)

    found another entry in this forum that pointed me to website. he had a great sample there and, after looking at his code, realised that I had omitted a comma after the second string variable

    For any of you suffering the same problem, this works...

    DBEngine.CompactDatabase strData, strBkp, , , ";pwd=*********"

    Thankyou dbForums and all your contributers

    Happy programming to you all
    Last edited by gilliebabes; 07-06-06 at 12:23.

Posting Permissions

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