Group:  Microsoft Access ยป microsoft.public.access.security
Thread: faqChangePassword

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

faqChangePassword
Olu Solaru 21.07.2006 14:46:02
Scenario - I am trying to implement an option for the user to be able to
change their password.

Accordingly, I have used the following Module code -


Function faqChangePassword(ByVal strUser As String, _
ByVal strPwd As String, ByVal strOldPwd As String) As Integer

Dim ws As Workspace
Dim usr As User
On Error GoTo err_ChangePassword

Set ws = DBEngine.Workspaces(0)
Set usr = ws.Users(strUser)
usr.NewPassword strOldPwd, strPwd
err_ChangePassword:
If Err.Number = 3033 Then
MsgBox "You do not have permission to modify passwords. Please contact your
System Administrator"
End If

End Function

However, this code is giving me the message (msgbox text). Whenever I try
to change my password. I have admin rights. This will obviously propogate
to other users when they attempt to change their password.

What changes should I make in the function that will not give me permission
denied message.?
Re: faqChangePassword
"Joan Wild" <jwild[ at ]nospamtyenet.com> 21.07.2006 16:59:45
How are you calling the function? You need to pass it the username,
password and old password.

--
Joan Wild
Microsoft Access MVP

Olu Solaru wrote:
[Quoted Text]
> Scenario - I am trying to implement an option for the user to be able
> to change their password.
>
> Accordingly, I have used the following Module code -
>
>
> Function faqChangePassword(ByVal strUser As String, _
> ByVal strPwd As String, ByVal strOldPwd As String) As Integer
>
> Dim ws As Workspace
> Dim usr As User
> On Error GoTo err_ChangePassword
>
> Set ws = DBEngine.Workspaces(0)
> Set usr = ws.Users(strUser)
> usr.NewPassword strOldPwd, strPwd
> err_ChangePassword:
> If Err.Number = 3033 Then
> MsgBox "You do not have permission to modify passwords. Please
> contact your System Administrator"
> End If
>
> End Function
>
> However, this code is giving me the message (msgbox text). Whenever
> I try to change my password. I have admin rights. This will
> obviously propogate to other users when they attempt to change their
> password.
>
> What changes should I make in the function that will not give me
> permission denied message.?


Re: faqChangePassword
Olu Solaru 21.07.2006 18:29:02
Here's a sample of my code -

Private Sub cmdChangePassWord_Click()
Dim v_PW_Return As Integer
v_PW_Return = faqChangePassword(CurrentUser(), Me.txtUserName, Me.txtPassword)
End Sub


"Joan Wild" wrote:

[Quoted Text]
> How are you calling the function? You need to pass it the username,
> password and old password.
>
> --
> Joan Wild
> Microsoft Access MVP
>
> Olu Solaru wrote:
> > Scenario - I am trying to implement an option for the user to be able
> > to change their password.
> >
> > Accordingly, I have used the following Module code -
> >
> >
> > Function faqChangePassword(ByVal strUser As String, _
> > ByVal strPwd As String, ByVal strOldPwd As String) As Integer
> >
> > Dim ws As Workspace
> > Dim usr As User
> > On Error GoTo err_ChangePassword
> >
> > Set ws = DBEngine.Workspaces(0)
> > Set usr = ws.Users(strUser)
> > usr.NewPassword strOldPwd, strPwd
> > err_ChangePassword:
> > If Err.Number = 3033 Then
> > MsgBox "You do not have permission to modify passwords. Please
> > contact your System Administrator"
> > End If
> >
> > End Function
> >
> > However, this code is giving me the message (msgbox text). Whenever
> > I try to change my password. I have admin rights. This will
> > obviously propogate to other users when they attempt to change their
> > password.
> >
> > What changes should I make in the function that will not give me
> > permission denied message.?
>
>
>
Re: faqChangePassword
"Joan Wild" <jwild[ at ]nospamtyenet.com> 21.07.2006 18:52:08
Me.txtUserName, should be Me.txtNewPassword i.e. whatever textbox they put
their new password into.
CurrentUser() captures the current username.
Me.txtPassword would be the old password.
Do you have a textbox for the NewPassword?

--
Joan Wild
Microsoft Access MVP

Olu Solaru wrote:
[Quoted Text]
> Here's a sample of my code -
>
> Private Sub cmdChangePassWord_Click()
> Dim v_PW_Return As Integer
> v_PW_Return = faqChangePassword(CurrentUser(), Me.txtUserName,
> Me.txtPassword) End Sub
>
>
> "Joan Wild" wrote:
>
>> How are you calling the function? You need to pass it the username,
>> password and old password.
>>
>> --
>> Joan Wild
>> Microsoft Access MVP
>>
>> Olu Solaru wrote:
>>> Scenario - I am trying to implement an option for the user to be
>>> able to change their password.
>>>
>>> Accordingly, I have used the following Module code -
>>>
>>>
>>> Function faqChangePassword(ByVal strUser As String, _
>>> ByVal strPwd As String, ByVal strOldPwd As String) As Integer
>>>
>>> Dim ws As Workspace
>>> Dim usr As User
>>> On Error GoTo err_ChangePassword
>>>
>>> Set ws = DBEngine.Workspaces(0)
>>> Set usr = ws.Users(strUser)
>>> usr.NewPassword strOldPwd, strPwd
>>> err_ChangePassword:
>>> If Err.Number = 3033 Then
>>> MsgBox "You do not have permission to modify passwords. Please
>>> contact your System Administrator"
>>> End If
>>>
>>> End Function
>>>
>>> However, this code is giving me the message (msgbox text). Whenever
>>> I try to change my password. I have admin rights. This will
>>> obviously propogate to other users when they attempt to change their
>>> password.
>>>
>>> What changes should I make in the function that will not give me
>>> permission denied message.?


Re: faqChangePassword
Olu Solaru 21.07.2006 19:12:01
I only have two textboxes, one for the username and one to enter in the new
password. I do not have one for the old password.

"Joan Wild" wrote:

[Quoted Text]
> Me.txtUserName, should be Me.txtNewPassword i.e. whatever textbox they put
> their new password into.
> CurrentUser() captures the current username.
> Me.txtPassword would be the old password.
> Do you have a textbox for the NewPassword?
>
> --
> Joan Wild
> Microsoft Access MVP
>
> Olu Solaru wrote:
> > Here's a sample of my code -
> >
> > Private Sub cmdChangePassWord_Click()
> > Dim v_PW_Return As Integer
> > v_PW_Return = faqChangePassword(CurrentUser(), Me.txtUserName,
> > Me.txtPassword) End Sub
> >
> >
> > "Joan Wild" wrote:
> >
> >> How are you calling the function? You need to pass it the username,
> >> password and old password.
> >>
> >> --
> >> Joan Wild
> >> Microsoft Access MVP
> >>
> >> Olu Solaru wrote:
> >>> Scenario - I am trying to implement an option for the user to be
> >>> able to change their password.
> >>>
> >>> Accordingly, I have used the following Module code -
> >>>
> >>>
> >>> Function faqChangePassword(ByVal strUser As String, _
> >>> ByVal strPwd As String, ByVal strOldPwd As String) As Integer
> >>>
> >>> Dim ws As Workspace
> >>> Dim usr As User
> >>> On Error GoTo err_ChangePassword
> >>>
> >>> Set ws = DBEngine.Workspaces(0)
> >>> Set usr = ws.Users(strUser)
> >>> usr.NewPassword strOldPwd, strPwd
> >>> err_ChangePassword:
> >>> If Err.Number = 3033 Then
> >>> MsgBox "You do not have permission to modify passwords. Please
> >>> contact your System Administrator"
> >>> End If
> >>>
> >>> End Function
> >>>
> >>> However, this code is giving me the message (msgbox text). Whenever
> >>> I try to change my password. I have admin rights. This will
> >>> obviously propogate to other users when they attempt to change their
> >>> password.
> >>>
> >>> What changes should I make in the function that will not give me
> >>> permission denied message.?
>
>
>
Re: faqChangePassword
"Joan Wild" <jwild[ at ]nospamtyenet.com> 21.07.2006 21:59:33
You need to have one for the old password. Ordinary users must supply their
old password. Members of the Admins group don't need to do this - thus a
way for them to reset someone's password.

--
Joan Wild
Microsoft Access MVP

Olu Solaru wrote:
[Quoted Text]
> I only have two textboxes, one for the username and one to enter in
> the new password. I do not have one for the old password.
>
> "Joan Wild" wrote:
>
>> Me.txtUserName, should be Me.txtNewPassword i.e. whatever textbox
>> they put their new password into.
>> CurrentUser() captures the current username.
>> Me.txtPassword would be the old password.
>> Do you have a textbox for the NewPassword?
>>
>> --
>> Joan Wild
>> Microsoft Access MVP
>>
>> Olu Solaru wrote:
>>> Here's a sample of my code -
>>>
>>> Private Sub cmdChangePassWord_Click()
>>> Dim v_PW_Return As Integer
>>> v_PW_Return = faqChangePassword(CurrentUser(), Me.txtUserName,
>>> Me.txtPassword) End Sub
>>>
>>>
>>> "Joan Wild" wrote:
>>>
>>>> How are you calling the function? You need to pass it the
>>>> username, password and old password.
>>>>
>>>> --
>>>> Joan Wild
>>>> Microsoft Access MVP
>>>>
>>>> Olu Solaru wrote:
>>>>> Scenario - I am trying to implement an option for the user to be
>>>>> able to change their password.
>>>>>
>>>>> Accordingly, I have used the following Module code -
>>>>>
>>>>>
>>>>> Function faqChangePassword(ByVal strUser As String, _
>>>>> ByVal strPwd As String, ByVal strOldPwd As String) As Integer
>>>>>
>>>>> Dim ws As Workspace
>>>>> Dim usr As User
>>>>> On Error GoTo err_ChangePassword
>>>>>
>>>>> Set ws = DBEngine.Workspaces(0)
>>>>> Set usr = ws.Users(strUser)
>>>>> usr.NewPassword strOldPwd, strPwd
>>>>> err_ChangePassword:
>>>>> If Err.Number = 3033 Then
>>>>> MsgBox "You do not have permission to modify passwords. Please
>>>>> contact your System Administrator"
>>>>> End If
>>>>>
>>>>> End Function
>>>>>
>>>>> However, this code is giving me the message (msgbox text).
>>>>> Whenever I try to change my password. I have admin rights.
>>>>> This will obviously propogate to other users when they attempt to
>>>>> change their password.
>>>>>
>>>>> What changes should I make in the function that will not give me
>>>>> permission denied message.?


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net