Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP major code malfunction

Status
Not open for further replies.

yourdeployedson

Programmer
Feb 8, 2006
11
US
I have this code and i cant seem to get it to work. Right now it stops at the third line.

Dim wrkdefault as workspace

I don't know why or how to fix it. here is the complete code

Private Sub NewPassword_Click()
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 workdefault = DB
Engine.workspaces (0)
With workdefault = 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
 
Have you got a reference to the Microsoft DAO x.x Object Library?

I think you may find you have several other errors, for example:
[tt]Set workdefault = DB
Engine.workspaces (0)
With workdefault = DBEngine.workspaces(0)
With WrkDefault[/tt]
Seems a bit of a mess. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top