Results 1 to 6 of 6
  1. #1
    harrypotter is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    3

    Question Access 2010 (accdb) "not a valid password"

    Hi, I'm using VB6 to connect to Ms Access 2010 (accdb format).
    The library i'm using is "Microsoft Office 14.0 Access database engine Object Library"
    The accdb file is created with a password. But program hit "Run-time error 3031. Not a valid password" whenever attempt to open the connection. I'm sure the password is correct.

    Any help will be appreciated.

    My code as below:
    Sub OpenDB()
    Dim db As DAO.Database
    Dim ws As DAO.Workspace
    Dim rst As DAO.Recordset
    Set ws = DBEngine.Workspaces(0)
    Set db = ws.OpenDatabase("database1.accdb", False, False, ";PWD=12345")
    Set rst = db.OpenRecordset("house", dbOpenDynaset)
    If rst.RecordCount > 0 Then
    rst.MoveLast
    MsgBox rst!address
    End If
    rst.Close


    db.Close
    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    Try:

    "MS Access;PWD=12345"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    harrypotter is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    3
    Quote Originally Posted by June7 View Post
    Try:

    "MS Access;PWD=12345"
    tried before. doesn't work too

    Any suggestion else?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    Just noticed your code doesn't show full path. Check this link http://support.microsoft.com/kb/209953
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    harrypotter is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    3
    Quote Originally Posted by June7 View Post
    Just noticed your code doesn't show full path. Check this link http://support.microsoft.com/kb/209953
    it doesn't work....

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    This is really a VB6 question. You might try a forum that focuses on VB6 development. Code looks like it should work. I know VB and VBA language are very similar but they aren't identical. I don't even have VB6 software available.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. What does "not a valid bookmark" mean?
    By ejohnso4 in forum Forms
    Replies: 3
    Last Post: 06-05-2014, 08:49 AM
  2. "Not a valid bookmark" error...??????
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 06-16-2011, 11:50 AM
  3. "Automatically" populate UserID & Password for ODBC
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 06-02-2011, 11:18 AM
  4. Replies: 8
    Last Post: 11-12-2010, 10:55 AM
  5. change field to "password" type
    By ducecoop in forum Access
    Replies: 3
    Last Post: 11-11-2010, 12:02 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums