Error -- Not A Valid Password

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe-Paul

    #1

    Error -- Not A Valid Password

    Hi:

    I'm using VB 6.0 with an Access 2000 database. I set the password in the
    Access database to: abcdef1234. Then, using a MDIform, during the load
    event, I send the program to a procedure to get some info out of the
    database that has been password protected. I use the following code:

    Public Sub GetSecInfo()
    Dim secSQL As String, uName As String
    Dim secRst As DAO.Recordset
    Dim secDB As DAO.Database
    Dim secRc As Integer, i As Integer

    Set secDB = OpenDatabase(se cPath & "\Setup.mdb ", , False,
    "pwd=jprobb4649 ")

    My sql goes here.

    Anyway, when the program gets to the "Set secDB" statement, I get an error
    that says:
    Error 3031 -- Not a valid password.

    I've tried with and with the "pwd=" and that doesn't make any difference.

    How do I set the password in the database and then open the password
    protected database? I've seen it done in other programs using VB 6.0 and
    Access 2000, but have never seen the code.

    Thanks in advance for any assistance you can give me.

    JP



  • The Mess

    #2
    Re: Error -- Not A Valid Password

    Dont forget the semicolon:
    Set secDB = OpenDatabase(se cPath & "\Setup.mdb ", False, False, ";
    pwd=jprobb4649" )

    "Joe-Paul" <HarvestWind@co mcast.net> wrote in message
    news:CfydnV3UH6 duLf7ZRVn-sQ@comcast.com. ..[color=blue]
    > Hi:
    >
    > I'm using VB 6.0 with an Access 2000 database. I set the password in the
    > Access database to: abcdef1234. Then, using a MDIform, during the load
    > event, I send the program to a procedure to get some info out of the
    > database that has been password protected. I use the following code:
    >
    > Public Sub GetSecInfo()
    > Dim secSQL As String, uName As String
    > Dim secRst As DAO.Recordset
    > Dim secDB As DAO.Database
    > Dim secRc As Integer, i As Integer
    >
    > Set secDB = OpenDatabase(se cPath & "\Setup.mdb ", , False,
    > "pwd=jprobb4649 ")
    >
    > My sql goes here.
    >
    > Anyway, when the program gets to the "Set secDB" statement, I get an error
    > that says:
    > Error 3031 -- Not a valid password.
    >
    > I've tried with and with the "pwd=" and that doesn't make any difference.
    >
    > How do I set the password in the database and then open the password
    > protected database? I've seen it done in other programs using VB 6.0 and
    > Access 2000, but have never seen the code.
    >
    > Thanks in advance for any assistance you can give me.
    >
    > JP
    >
    >
    >[/color]


    Comment

    • Angelo

      #3
      Re: Error -- Not A Valid Password

      you had password abcdef1234 right? well.. why you do jprobb4649?
      [color=blue]
      > Set secDB = OpenDatabase(se cPath & "\Setup.mdb ", , False,
      > "pwd=jprobb4649 ")[/color]

      --
      _______________ ________
      / .,, /\ \|/ \
      ( MR. /--\.-` - O - `-.)
      ( / \ /|\ )
      \______________ _________/


      Comment

      • Joe-Paul

        #4
        Re: Error -- Not A Valid Password

        Because jprobb4649 is the real password that I copied out of the program....
        should have changed it before posting? :0(
        "Angelo" <angelo2@lancop .invalid> wrote in message
        news:44649090$0 $4776$e4fe514c@ dreader32.news. xs4all.nl...[color=blue]
        > you had password abcdef1234 right? well.. why you do jprobb4649?
        >[color=green]
        >> Set secDB = OpenDatabase(se cPath & "\Setup.mdb ", , False,
        >> "pwd=jprobb4649 ")[/color]
        >
        > --
        > _______________ ________
        > / .,, /\ \|/ \
        > ( MR. /--\.-` - O - `-.)
        > ( / \ /|\ )
        > \______________ _________/
        >[/color]


        Comment

        • Max Healey

          #5
          Re: Error -- Not A Valid Password

          When you say I set the password in the database, are you saying you changed
          the admin password in the work group?

          because there is a difference between a database that has a password set and
          the workgroup passwords


          the work group passwords are much more useful because you can give various
          users different permissions, I use this in my apps to hide some of my better
          query's from the casual user by setting them as not visible to the admin
          user, so simply opening the database in access will not display them.

          much better then setting a password because they don't know it is there a
          password is asking for some one to use a cracking tool.

          The code you have would work if you changed the administrator password in
          the mde but then you would need to distribute the MDE file as well as the
          mdb and you would need to set its path in the connection string. "Jet
          OLEDB:System database=c:\xxx \.xx.mde"

          I have not done anything in DAO in years but this example found on a google
          search would work in ADO for a situation where the database password is set.

          Dim App_Cnn As ADODB.Connectio n
          Dim rs As ADODB.Recordset

          Set App_Cnn = New ADODB.Connectio n
          With App_Cnn
          .Provider = "Microsoft.Jet. OLEDB.4.0"
          .Properties("Da ta Source") = App.Path & "\Database\Clas s.mdb"
          .Properties("Je t OLEDB:Database Password") = YourDBPassword
          .Open
          End With


          Max


          "Joe-Paul" <HarvestWind@co mcast.net> wrote in message
          news:U4idnR6m0Y MHTvnZRVn-hg@comcast.com. ..[color=blue]
          > Because jprobb4649 is the real password that I copied out of the
          > program.... should have changed it before posting? :0(
          > "Angelo" <angelo2@lancop .invalid> wrote in message
          > news:44649090$0 $4776$e4fe514c@ dreader32.news. xs4all.nl...[color=green]
          >> you had password abcdef1234 right? well.. why you do jprobb4649?
          >>[color=darkred]
          >>> Set secDB = OpenDatabase(se cPath & "\Setup.mdb ", , False,
          >>> "pwd=jprobb4649 ")[/color]
          >>
          >> --
          >> _______________ ________
          >> / .,, /\ \|/ \
          >> ( MR. /--\.-` - O - `-.)
          >> ( / \ /|\ )
          >> \______________ _________/
          >>[/color]
          >
          >[/color]


          Comment

          • Max Healey

            #6
            Re: Error -- Not A Valid Password

            oops on the previosus post

            replace mde in my previous post with MDW (IE the work group file)

            "Max Healey" <maxat@healey.c om.au> wrote in message
            news:44651b1d$0 $10976$afc38c87 @news.optusnet. com.au...[color=blue]
            > When you say I set the password in the database, are you saying you
            > changed the admin password in the work group?
            >
            > because there is a difference between a database that has a password set
            > and the workgroup passwords
            >
            >
            > the work group passwords are much more useful because you can give various
            > users different permissions, I use this in my apps to hide some of my
            > better query's from the casual user by setting them as not visible to the
            > admin user, so simply opening the database in access will not display
            > them.
            >
            > much better then setting a password because they don't know it is there a
            > password is asking for some one to use a cracking tool.
            >
            > The code you have would work if you changed the administrator password in
            > the mde but then you would need to distribute the MDE file as well as the
            > mdb and you would need to set its path in the connection string. "Jet
            > OLEDB:System database=c:\xxx \.xx.mde"
            >
            > I have not done anything in DAO in years but this example found on a
            > google search would work in ADO for a situation where the database
            > password is set.
            >
            > Dim App_Cnn As ADODB.Connectio n
            > Dim rs As ADODB.Recordset
            >
            > Set App_Cnn = New ADODB.Connectio n
            > With App_Cnn
            > .Provider = "Microsoft.Jet. OLEDB.4.0"
            > .Properties("Da ta Source") = App.Path & "\Database\Clas s.mdb"
            > .Properties("Je t OLEDB:Database Password") = YourDBPassword
            > .Open
            > End With
            >
            >
            > Max
            >
            >
            > "Joe-Paul" <HarvestWind@co mcast.net> wrote in message
            > news:U4idnR6m0Y MHTvnZRVn-hg@comcast.com. ..[color=green]
            >> Because jprobb4649 is the real password that I copied out of the
            >> program.... should have changed it before posting? :0(
            >> "Angelo" <angelo2@lancop .invalid> wrote in message
            >> news:44649090$0 $4776$e4fe514c@ dreader32.news. xs4all.nl...[color=darkred]
            >>> you had password abcdef1234 right? well.. why you do jprobb4649?
            >>>
            >>>> Set secDB = OpenDatabase(se cPath & "\Setup.mdb ", , False,
            >>>> "pwd=jprobb4649 ")
            >>>
            >>> --
            >>> _______________ ________
            >>> / .,, /\ \|/ \
            >>> ( MR. /--\.-` - O - `-.)
            >>> ( / \ /|\ )
            >>> \______________ _________/
            >>>[/color]
            >>
            >>[/color]
            >
            >[/color]


            Comment

            Working...