Results 1 to 5 of 5

Thread: Open an MS Access Database from VB

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923

    Post

    Hi, Does anyone know how I can physically open MSAccess itself with the database loaded from VB. You might say use the Shell function, but I need VB to supply a database password without the user seeing it, and I can't think how. I tried Sendkeys, but this can easily be overcome by giving Notepad focus....!!! Any ideas greatly received.

  2. #2
    Addicted Member
    Join Date
    Apr 1999
    Location
    Freeport
    Posts
    204

    Post

    This is how you open a database in VB and pwd=PasswordName will open a password protected database where PasswordName is your Password.
    Dim db as database
    Set db = OpenDatabase _
    ("Database Path And Name", False, False, "MS Access;pwd=Password Name")
    You can place the password in Window regisrty and use Api call to call back to a text box then use
    Dim db as database
    Set db = OpenDatabase _
    ("Database Path And Name", False, False, "MS Access;pwd=" & TextBox)

    ------------------

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923

    Post

    That's great, but how can I convert it to use with VB6. VB6 doesn't recognise Database as a data type - it says 'User-defined type not defined' when you try and run it.

  4. #4
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    Hi,

    Add a reference to the Microsoft DAO 3.5 Object Library from the menu Project|References.

    HTH,

    Preeti


  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923

    Post

    Doh! Why didn't I think of that...! Thanks ScottF and Preeti.

Posting Permissions

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



Click Here to Expand Forum to Full Width