PC Review


Reply
Thread Tools Rate Thread

Checking a users password

 
 
Martin
Guest
Posts: n/a
 
      17th Aug 2009
I have the below code that checks to see if a user has a blank password.
That section works. My problem is the else loop. No matter what password I
set for myself, I still get error 3029. My default password is "MARINES" and
I want to force users to change their default password.

My question is can I do it through code?

Thank you for your time and help.


Private Sub Form_Open(Cancel As Integer)

Dim ws As Workspace
Dim myset As Recordset
Dim db As Database
Dim iPerm As Integer
Dim iStud As Integer

On Error Resume Next

Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(), "")
Debug.Print CurrentUser()
Debug.Print err.number
If err = 0 Then
MsgBox "Your PASSWORD is blank. This will not be tolerated! Your
access to the dbase will be TERMINATED if not fixed NOW.", vbCritical
'users has a blank password
Set db = CurrentDb
Set myset = db.OpenRecordset("tblUsers", dbOpenTable)
myset.Index = "UserName"
myset.Seek "=", CurrentUser()
If myset.NoMatch Then
'Stop No matching record
MsgBox "No Matching UserName record", vbCritical
Else
'Stop found matching record
Debug.Print myset!UserName
myset.Edit
myset!BLANKPASSWORD = -1
myset.Update
End If
Else
' Stop
'users password is not blank
'check to see if it is still the default
Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(), "MARINES")
Debug.Print err.number, err.Description 'error = 3029 Not a valid
account name or password.
If err = 0 Then
'Stop 'user PASSWORD is still default
MsgBox "Your PASSWORD is still the default. Please change your
password or you will loose your access to the company dbase. Don't know how.
Call 8582 and talk to Mr. Cox.", vbCritical
Else
'Stop 'user has changed their password
MsgBox "Thank you for changing your PASSWORD. ", vbCritical
End If
End If

 
Reply With Quote
 
 
 
 
Martin
Guest
Posts: n/a
 
      19th Aug 2009
If you look at my question "determining if users Password is blank or
standard" posted 8/6/2009 6:54 PM PST, I was told to try On Error Resume Next
to trap this error. This fixed the code from Joan Wild but now I am trying
to get users to change their default password I have assigned through code
and can't seem to determine when their password is "MARINES"

Thank you for your response. Hope you can help me.

"AccessVandal via AccessMonster.com" wrote:

> I don't see that you have any error trapping on. Judging from this, I don't
> think this error comes from the form' open event.
>
> What's with the "On Error Resume Next" for ignoring errors?
>
> Martin wrote:
> >I have the below code that checks to see if a user has a blank password.
> >That section works. My problem is the else loop. No matter what password I
> >set for myself, I still get error 3029. My default password is "MARINES" and
> >I want to force users to change their default password.
> >
> >My question is can I do it through code?
> >
> >Thank you for your time and help.
> >
> >Private Sub Form_Open(Cancel As Integer)
> >
> >Dim ws As Workspace
> >Dim myset As Recordset
> >Dim db As Database
> >Dim iPerm As Integer
> >Dim iStud As Integer
> >
> >On Error Resume Next
> >
> >Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(), "")
> >Debug.Print CurrentUser()
> >Debug.Print err.number
> >If err = 0 Then
> > MsgBox "Your PASSWORD is blank. This will not be tolerated! Your
> >access to the dbase will be TERMINATED if not fixed NOW.", vbCritical
> > 'users has a blank password
> > Set db = CurrentDb
> > Set myset = db.OpenRecordset("tblUsers", dbOpenTable)
> > myset.Index = "UserName"
> > myset.Seek "=", CurrentUser()
> > If myset.NoMatch Then
> > 'Stop No matching record
> > MsgBox "No Matching UserName record", vbCritical
> > Else
> > 'Stop found matching record
> > Debug.Print myset!UserName
> > myset.Edit
> > myset!BLANKPASSWORD = -1
> > myset.Update
> > End If
> >Else
> >' Stop
> > 'users password is not blank
> > 'check to see if it is still the default
> > Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(), "MARINES")
> > Debug.Print err.number, err.Description 'error = 3029 Not a valid
> >account name or password.
> > If err = 0 Then
> > 'Stop 'user PASSWORD is still default
> > MsgBox "Your PASSWORD is still the default. Please change your
> >password or you will loose your access to the company dbase. Don't know how.
> > Call 8582 and talk to Mr. Cox.", vbCritical
> > Else
> > 'Stop 'user has changed their password
> > MsgBox "Thank you for changing your PASSWORD. ", vbCritical
> > End If
> >End If

>
> --
> Please Rate the posting if helps you.
>
> Message posted via http://www.accessmonster.com
>
>

 
Reply With Quote
 
Martin
Guest
Posts: n/a
 
      20th Aug 2009
AccessVandal,

Thank You. Thank You. Thank You. I used your recommendations and my dbase
now works the way I want it to.

Thank you again.

"AccessVandal via AccessMonster.com" wrote:

> PS
>
> Sorry forgot about one more thing. You'll need to reset the error, so a
> simple one line will do. Just put this line just before the second
> CreateWorkSpace like
>
> ' Stop
> 'users password is not blank
> 'check to see if it is still the default
> 'add one line to reset error
> Err = 0 'add this code here just before the second CreateWorkSpace
> Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(), "MARINES")
> Debug.Print err.number, err.Description 'error = 3029 Not a valid
> account name or password.
>
> else the code will not work.
>
> HTH
> Martin wrote:
> >If you look at my question "determining if users Password is blank or
> >standard" posted 8/6/2009 6:54 PM PST, I was told to try On Error Resume Next
> >to trap this error. This fixed the code from Joan Wild but now I am trying
> >to get users to change their default password I have assigned through code
> >and can't seem to determine when their password is "MARINES"

>
> --
> Please Rate the posting if helps you.
>
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...urity/200908/1
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change a users password without knowing the old password nor the answer to the password question AAaron123 Microsoft ASP .NET 1 16th Jan 2009 02:56 PM
Changing a users password without knowing the old password nor the answer to the password question AAaron123 Microsoft ASP .NET 2 16th Jan 2009 02:08 PM
Checking Users Connectivity prabhupr@hotmail.com Microsoft ASP .NET 0 20th Mar 2006 05:24 AM
If i turn on min password length, existing users or new users affe =?Utf-8?B?TXVnZW4=?= Microsoft Windows 2000 1 7th Jun 2005 04:34 AM
Checking for online Users and Login Users alex Microsoft VB .NET 1 7th Sep 2004 12:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:56 AM.