Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

puts password to db

Posted on 2000-04-23
4
Medium Priority
?
135 Views
Last Modified: 2010-05-02
hi,


i have a question here... i have make the database using coding from vb with dao object. can i put/change password/existing password from the database.
0
Comment
Question by:cindafuzzy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
wsh2 earned 304 total points
ID: 2741774
With DAO 3.6.. From MSDN:

--------------------------------------
NewPassword Method

Changes the password of an existing user account or Microsoft Jet database (Microsoft Jet workspaces only).

Syntax

object.NewPassword oldpassword, newpassword

The NewPassword method syntax has these parts.

Part Description
object An object variable that represents the User object or a Microsoft Jet 3.x Database object whose Password property you want to change.
oldpassword A String that is the current setting of the Password property of the User or Jet 3.x Database object.
newpassword A String that is the new setting of the Password property of the User or Jet 3.x Database object.

Remarks

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.

Passwords are case-sensitive.

If object refers to a User object that is not yet appended to a Users collection, an error occurs. To set a new password, you must either log on as the user whose account you're changing, or you must be a member of the Admins group. The Password property of a User object is write-only — users can't read the current value.

If object refers to a Microsoft Jet version 3.0 or later Database object, this method offers some security by means of password protection. When you create or open a Microsoft Jet 3.x .mdb file, part of the Connect connection string can describe the password.

If a database has no password, Microsoft Jet will automatically create one by passing a zero-length string ("") for the old password.

Caution   If you lose your password, you can never open the database again.
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2741783
NewPassword Method Example.. From MSDN:

---------------------------------------
NewPassword Method Example

This example asks the user for a new password for user Pat Smith. If the input is a string between 1 and 14 characters long, the example uses the NewPassword method to change the password. The user must be logged on as Pat Smith or as a member of the Admins group.

Sub NewPasswordX()

    Dim wrkDefault As Workspace
    Dim usrNew As User
    Dim grpNew As Group
    Dim grpMember As Group
    Dim strPassword As String

    ' Get default workspace.
    Set wrkDefault = DBEngine.Workspaces(0)

    With wrkDefault

        ' Create and append new user.
        Set usrNew = .CreateUser("Pat Smith", _
            "abc123DEF456", "Password1")
        .Users.Append usrNew

        ' Create and append new group.
        Set grpNew = .CreateGroup("Accounting", _
            "UVW987xyz654")
        .Groups.Append grpNew

        ' Make the new user a member of the new group.
        Set grpMember = usrNew.CreateGroup("Accounting")
        usrNew.Groups.Append grpMember

        ' Ask user for new password. If input is too long, ask
        ' again.
        Do While True
            strPassword = InputBox("Enter new password:")
            Select Case Len(strPassword)
                Case 1 To 14
                    usrNew.NewPassword "Password1", strPassword
                    MsgBox "Password changed!"
                    Exit Do
                Case Is > 14
                    MsgBox "Password too long!"
                Case 0
                    Exit Do
            End Select
        Loop

        ' Delete new User and Group objects because this
        ' is only a demonstration.
        .Users.Delete "Pat Smith"
        .Groups.Delete "Accounting"

    End With

End Sub
0
 

Author Comment

by:cindafuzzy
ID: 2742015
Adjusted points from 75 to 76
0
 

Author Comment

by:cindafuzzy
ID: 2742016
thanks, some bits it really help me...
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question