Results 1 to 10 of 10

Thread: Opening DB with password

  1. #1

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Cool

    Ok say you create a db like this:
    Set dbsData = CreateDatabase("C:\NewDB.mdb", dbLangGeneral & ";pwd=password")
    ok so now you want to open it like this
    Set dbsData = OpenDatabase("C:\NewDB1.mdb")
    but then you get a message and error saying invalid password so I looked in then help and it says this
    Set database = workspace.OpenDatabase (dbname, options, read-only, connect)

    and it says for the connect Optional. A Variant (String subtype) that specifies various connection information, including passwords. I have tried and tried so many different ways to put the password in there and nothing works. so how do you open it?
    Thanks!!
    Sincerely,
    Chris


    Email: [email protected]
    AIM: KnightsOfTheMoon
    WebPage: http://kom.wicre.com
    ----------------
    VB6 Professional
    Abit ST6-RAID
    1000 MHZ
    512 MB PC133 Ram
    Nvidia GeForce 2 Ultra 64 MB
    Maxtor 81.9 Gig
    Win 98 SE

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    You have to pass the password to the OpenDatabase function everytime you try to open a database with password protection via the Connect parameter. In other words the Connect string parameter isn't optional when your database requires a password to be opened.

    Code:
    Set dbs = DBEngine.OpenDatabase("C:/MyDataBase.mdb", , , ";PWD=Password")


    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Angry Somethings Wrong

    You Gave me this code: Set dbs = DBEngine.OpenDatabase("C:/MyDataBase.mdb", , , ";PWD=Password")

    I have no idea what to put for dbengine and dbs but i was taught to put this
    Set dbsData = OpenDatabase("C:\NewDB.mdb")

    so i figured i would do a little something like this

    Set dbsData = OpenDatabase("C:\NewDB.mdb", , , ";pwd=password")

    But to no luck it still didn't work so I added

    Set dbsData = dbengine.OpenDatabase("C:\NewDB.mdb", , , ";pwd=password")

    and then the invalid password came back up.
    so why on earth is it still giving me invalid password?


    Sincerely,
    Chris


    Email: [email protected]
    AIM: KnightsOfTheMoon
    WebPage: http://kom.wicre.com
    ----------------
    VB6 Professional
    Abit ST6-RAID
    1000 MHZ
    512 MB PC133 Ram
    Nvidia GeForce 2 Ultra 64 MB
    Maxtor 81.9 Gig
    Win 98 SE

  4. #4
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Are you passing the correct password to the function, it is case sensitive so if when you set the password you typed it in all caps then you need to pass it as all caps. I think the VB help file can best describe the DBEngine object.
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  5. #5
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Missing parameter

    Hi PITBULLCJR,

    you are missing two parameters in your OpenDatabase statement, it should be like below:

    Code:
    Set db = DBEngine.Workspaces(0).OpenDatabase(App.Path & "\db1.mdb", False, False, ";pwd=password")
    pls. refer below for more information:

    Syntax

    Set database = workspace.OpenDatabase (dbname, options, read-only, connect)

    The OpenDatabase method syntax has these parts.


    database An object variable that represents the Database object that you want to open.

    workspace Optional. An object variable that represents the existing Workspace object that will contain the database. If you don't include a value for workspace, OpenDatabase uses the default workspace.

    dbname A String that is the name of an existing Microsoft Jet database file, or the data source name (DSN) of an ODBC data source. See the Name property for more information about setting this value.

    options Optional. A Variant that sets various options for the database, as specified in Settings.

    read-only Optional. A Variant (Boolean subtype) value that is True if you want to open the database with read-only access, or False (default) if you want to open the database with read/write access.

    connect Optional. A Variant (String subtype) that specifies various connection information, including passwords.

  6. #6

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Talking Thanks!!!!!

    Thank You YoungBuck for trying to help me!!! Thank You Chris for fixing the problem. I have a question for you both nope nevermind fixed it. The problem was I couldn't create a new Table but stupid me forgot to dim tdftable as tabledef so thanks anyway. Thank you again so much!!
    Sincerely,
    Chris


    Email: [email protected]
    AIM: KnightsOfTheMoon
    WebPage: http://kom.wicre.com
    ----------------
    VB6 Professional
    Abit ST6-RAID
    1000 MHZ
    512 MB PC133 Ram
    Nvidia GeForce 2 Ultra 64 MB
    Maxtor 81.9 Gig
    Win 98 SE

  7. #7

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Cool Are....

    Are you guys (YoungBuck and Chris) very good Database programmers? If you are do you think I could like keep your email addresses in my address book so that if I have any questions I could email them to you? Thanks!!
    Sincerely,
    Chris


    Email: [email protected]
    AIM: KnightsOfTheMoon
    WebPage: http://kom.wicre.com
    ----------------
    VB6 Professional
    Abit ST6-RAID
    1000 MHZ
    512 MB PC133 Ram
    Nvidia GeForce 2 Ultra 64 MB
    Maxtor 81.9 Gig
    Win 98 SE

  8. #8
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Sure or you can just post it here!

    [Edited by YoungBuck on 05-27-2000 at 02:02 PM]
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  9. #9
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Thumbs up Keep in touch

    Hi PITBULLCJR,
    Yes, you're welcome to keep me n your address book, mean while you also can post to this bulletin board, cause I'll read the post from time to time.


  10. #10

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Talking

    Thanks you guys!!
    Sincerely,
    Chris


    Email: [email protected]
    AIM: KnightsOfTheMoon
    WebPage: http://kom.wicre.com
    ----------------
    VB6 Professional
    Abit ST6-RAID
    1000 MHZ
    512 MB PC133 Ram
    Nvidia GeForce 2 Ultra 64 MB
    Maxtor 81.9 Gig
    Win 98 SE

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