R
RobUCSD
I found this code as an example of how to impement the ALTER USER statement
in my program. I'm not sure how to do this. It looks as though I'd place this
behind a form with the with text boxes. Can anyone help me with this, it
would be greatly appreciated.
Thanks Rob
Sub NewPasswordX()
On Error GoTo errorpass
Dim WrkDefault As Workspace
Dim usrNew As User
Dim grpNew As Group
Dim grpMember As Group
Dim strPassword As String, oldPassword As String
' Get default workspace.
Set WrkDefault = DBEngine.Workspaces(0)
With WrkDefault
' Create and append new user.
Set usrNew = .Users(CurrentUser)
' Ask user for new password. If input is too long, ask again.
Do While True
oldPassword = InputBox("Enter old password:" &
vbCrLf & "(Remember that passwords are case sensitive.
Check that your CAPS LOCK key is OFF, and if your password
contains numbers, that the NUM LOCK key is ON.)", "Old
Password")
strPassword = InputBox("Enter new password:" &
vbCrLf & "(Remember that passwords are case sensitive.
Check that your CAPS LOCK key is OFF, and if your password
contains numbers, that the NUM LOCK key is ON.)", "New
Password")
Select Case Len(strPassword)
Case 1 To 14
usrNew.NewPassword oldPassword,
strPassword
MsgBox "Password changed!",
vbInformation, "Success"
Exit Do
Case Else
MsgBox "New password too long (14
characters maximum), or contains invalid characters." &
vbCrLf & "Password was not changed.", vbCritical, "Failure"
Exit Do
End Select
Loop
End With
Exit Sub
errorpass:
If Err.Number = 3033 Then
MsgBox "The old password you supplied is
incorrect. The password was not changed.",
vbInformation, "Failure"
Exit Sub
Else
MsgBox Err.Description & vbCrLf & "Error Number: "
& Err.Number
Exit Sub
End If
End Sub
in my program. I'm not sure how to do this. It looks as though I'd place this
behind a form with the with text boxes. Can anyone help me with this, it
would be greatly appreciated.
Thanks Rob
Sub NewPasswordX()
On Error GoTo errorpass
Dim WrkDefault As Workspace
Dim usrNew As User
Dim grpNew As Group
Dim grpMember As Group
Dim strPassword As String, oldPassword As String
' Get default workspace.
Set WrkDefault = DBEngine.Workspaces(0)
With WrkDefault
' Create and append new user.
Set usrNew = .Users(CurrentUser)
' Ask user for new password. If input is too long, ask again.
Do While True
oldPassword = InputBox("Enter old password:" &
vbCrLf & "(Remember that passwords are case sensitive.
Check that your CAPS LOCK key is OFF, and if your password
contains numbers, that the NUM LOCK key is ON.)", "Old
Password")
strPassword = InputBox("Enter new password:" &
vbCrLf & "(Remember that passwords are case sensitive.
Check that your CAPS LOCK key is OFF, and if your password
contains numbers, that the NUM LOCK key is ON.)", "New
Password")
Select Case Len(strPassword)
Case 1 To 14
usrNew.NewPassword oldPassword,
strPassword
MsgBox "Password changed!",
vbInformation, "Success"
Exit Do
Case Else
MsgBox "New password too long (14
characters maximum), or contains invalid characters." &
vbCrLf & "Password was not changed.", vbCritical, "Failure"
Exit Do
End Select
Loop
End With
Exit Sub
errorpass:
If Err.Number = 3033 Then
MsgBox "The old password you supplied is
incorrect. The password was not changed.",
vbInformation, "Failure"
Exit Sub
Else
MsgBox Err.Description & vbCrLf & "Error Number: "
& Err.Number
Exit Sub
End If
End Sub