none
Compactdatabase DAO 3.5 et 3.6

    Question

  • i try to use compactdatabase with an MDb created with dbversion30 and dblangarabic procted with a password.i receive always invalid password 3031.

    someone can send me the syntax exact to avoid this error.thks

    for information im using VB 6

    Tuesday, April 28, 2009 6:17 PM

Answers

  • Yes, the article states that a password cannot exceed 13 characters when using CompactDatabase.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Marked as answer by Djam57 Thursday, April 30, 2009 3:15 PM
    Wednesday, April 29, 2009 7:03 PM

All replies

  • Could you post the CompactDatabase code you have?
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, April 28, 2009 8:19 PM
  • thks for answering
     
    this is my code 
     
    dbengine.Compactdatabase MdbSource, MdbDestionation, dbLangArabic , dbversion30, ";Pwd=MonPassword"
     
    Tuesday, April 28, 2009 8:25 PM
  • Thank you Paul for your friendly help.


    Hi Djam,

    1. Your source code looks OK. Please try the following options:
    dbengine.Compactdatabase MdbSource, MdbDestionation, dbLangGeneral, dbVersion30, ";Pwd=MonPassword"
    dbengine.Compactdatabase MdbSource, MdbDestionation, , , ";Pwd=MonPassword"

    2. DBEngine.CompactDatabase Syntax:

    DBEngine.CompactDatabase olddb, newdb [, locale [, options[, ;pwd=password]]]

     

    Part           Description

    password       An optional string argument containing a password, if the

                   database is password protected. The string ";pwd=" must

                   precede the actual password.


    Please check this KB article for reference:
    http://support.microsoft.com/kb/162958
    "Fix: Format of the Password Parameter for DBEngine.CompactDatabase"

    3. It's likely to get better responses at related VB6 forums:
        Sticky: For Visual Basic 6 questions, please read...


    4. By the way, we can also use DBEngine.CompactDatabase to backup MS Access database in VB.NET.

    Add reference to COM component:
    Microsoft DAO Object Library to your project.

     Dim db As New DAO.DBEngine

     db.CompactDatabase(MdbSource, MdbDestionation,,,";pwd=xxxx")

    Trackback: http://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/0dacf318-24fa-4962-91b5-69a246c6684d/


    Best regards,
    Martin Xie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Wednesday, April 29, 2009 6:30 AM
  • i try to use compactdatabase with an MDb created with dbversion30 and dblangarabic procted with a password.i receive always invalid password 3031.

    someone can send me the syntax exact to avoid this error.thks

    for information im using VB 6

    this is my code 
     
    dbengine.Compactdatabase MdbSource, MdbDestionation, dbLangArabic , dbversion30, ";Pwd=MonPassword"

    • Merged by Martin Xie - MSFT Thursday, April 30, 2009 5:06 AM Merge it to keep them in the same topic.
    Wednesday, April 29, 2009 1:05 PM
  • I wasn't able to reproduce the error with the code you provided but maybe the following applies to your scenario:

    ACC: "Run-Time Error '3031': Not a Valid Password" Error Message
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, April 29, 2009 2:12 PM
  • yes the same error even the syntax provieded by documentation.


    its bizare
    Wednesday, April 29, 2009 2:52 PM
  • What about the password length issue?
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, April 29, 2009 3:11 PM
  • password respect length (14 char max) .i thk compactdatabase is non optional parameters

    may be  im not sure
    Wednesday, April 29, 2009 3:17 PM
  • I guess what I was asking was does your password exceed 13 characters in length? If so, you will need to shorten it in order to use CompactDatabase.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, April 29, 2009 4:16 PM
  • HELP Visual Basic

    NewPassword Method

    The oldpassword and newpassword strings can be up to 14 characters long and can include any characters except the ASCII character 0 (null). To clear the password, use a zero-length string ("") for newpassword
    .


    let me tell you that i use 14 chars lenght and it works well when opening my base even when i exexuting SQL command . why should I put only use 13 chars ? i dont understand ! or you want me to execute the compactdataabse Method only with 13 char.

    let me tell you more .

    i tried to compact my base like below

    dbs.NewPassword mypassword,""

    dbs.compactdatabase MySource,MyDestination

    dbs.NewPassword "",MyPassword

    It works with 14 chats lenght

    im asking you why compactdatabase method does works simply

     

    thks

     

     

     

     

     

     

     

     

    Wednesday, April 29, 2009 6:20 PM
  • Did you read the link to the below article from my previous post?

    ACC: "Run-Time Error '3031': Not a Valid Password" Error Message


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, April 29, 2009 6:36 PM
  • you are saying that :

    with only compactdatabase we cant exceed 13 chars for password .

    and i can use 14 chars with others methods


    im going to try it thk

    Wednesday, April 29, 2009 6:57 PM
  • Yes, the article states that a password cannot exceed 13 characters when using CompactDatabase.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Marked as answer by Djam57 Thursday, April 30, 2009 3:15 PM
    Wednesday, April 29, 2009 7:03 PM
  • Thks its works finally with your help
    Thursday, April 30, 2009 3:15 PM