PC Review


Reply
Thread Tools Rate Thread

determining if users Password is blank or standard

 
 
Martin
Guest
Posts: n/a
 
      7th Aug 2009
I tried to use the below code from a post by Joan Wild and it does not work.
I placed the code on the open event of my main switchboard form.

The VBA compiler did not like the line

Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(), "")

If the user has a password, you get error 3029. Not a valid account name or
password.

So I added an On Error event to try to capture the error. This does not
work either.
Whether the user has a blank or a valid password, the err that is returned
is always zero. I check the code by changing my password from blank to a
valid password through the Tools menu.

I have included my new code at the bottom of this post.

Thank you for your time.

"Joan Wild" wrote:

> You can try to open a new workspace, passing CurrentUser() as the username
> and "" as the password.
> If you don't get an error, then the "" password is correct, and they have a
> blank password.
>
> Dim ws as Workspace
> Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(),"")
> If Err=0 then
> 'they have a blank password
> 'open a form for them to change their password
> Else
> 'they don't have a blank password
> 'do nothing
> End If
>
>
> --
> Joan Wild
> Microsoft Access MVP


New code I tried.

Dim ws As Workspace

On Error GoTo ErrLogin

Set ws = CreateWorkspace("tempws", CurrentUser(), "")
Debug.Print CurrentUser()
Debug.Print err.number
If err = 0 Then
Stop
'users password is not blank
Else
Stop
'users has a blank password
End If

ErrLogin:
If err.number = 3029 Then
Resume Next
End If

 
Reply With Quote
 
 
 
 
Tom van Stiphout
Guest
Posts: n/a
 
      7th Aug 2009
On Thu, 6 Aug 2009 18:55:01 -0700, Martin
<(E-Mail Removed)> wrote:

The error object gets reset after each line of any consequence.
Thus:
Dim x As Integer
On Error GoTo Error_Handler
x = 1 / 0
Debug.Print Err.Number

Exit_Handler:
Exit Sub

Error_Handler:
If Err.Number = 11 Then
Resume Next
Else
Resume Exit_Handler
End If

The above code will print 0, even though we clearly had a division by
zero. After all, the If statement in the error handler executed
successfully.
I think this is one of the few cases where On Error Resume Next makes
sense:
Dim x As Integer
On Error Resume Next
x = 1 / 0
Debug.Print Err.Number
if Err.Number = 11 then Msgbox "Arrrccchhh"

-Tom.
Microsoft Access MVP


>I tried to use the below code from a post by Joan Wild and it does not work.
>I placed the code on the open event of my main switchboard form.
>
>The VBA compiler did not like the line
>
>Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(), "")
>
>If the user has a password, you get error 3029. Not a valid account name or
>password.
>
>So I added an On Error event to try to capture the error. This does not
>work either.
>Whether the user has a blank or a valid password, the err that is returned
>is always zero. I check the code by changing my password from blank to a
>valid password through the Tools menu.
>
>I have included my new code at the bottom of this post.
>
>Thank you for your time.
>
>"Joan Wild" wrote:
>
>> You can try to open a new workspace, passing CurrentUser() as the username
>> and "" as the password.
>> If you don't get an error, then the "" password is correct, and they have a
>> blank password.
>>
>> Dim ws as Workspace
>> Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(),"")
>> If Err=0 then
>> 'they have a blank password
>> 'open a form for them to change their password
>> Else
>> 'they don't have a blank password
>> 'do nothing
>> End If
>>
>>
>> --
>> Joan Wild
>> Microsoft Access MVP

>
>New code I tried.
>
>Dim ws As Workspace
>
>On Error GoTo ErrLogin
>
>Set ws = CreateWorkspace("tempws", CurrentUser(), "")
>Debug.Print CurrentUser()
>Debug.Print err.number
>If err = 0 Then
> Stop
> 'users password is not blank
>Else
> Stop
> 'users has a blank password
>End If
>
>ErrLogin:
> If err.number = 3029 Then
> Resume Next
> End If

 
Reply With Quote
 
Martin
Guest
Posts: n/a
 
      8th Aug 2009
Thank you Tom. Just what I needed.

Thank you again.

"Tom van Stiphout" wrote:

> On Thu, 6 Aug 2009 18:55:01 -0700, Martin
> <(E-Mail Removed)> wrote:
>
> The error object gets reset after each line of any consequence.
> Thus:
> Dim x As Integer
> On Error GoTo Error_Handler
> x = 1 / 0
> Debug.Print Err.Number
>
> Exit_Handler:
> Exit Sub
>
> Error_Handler:
> If Err.Number = 11 Then
> Resume Next
> Else
> Resume Exit_Handler
> End If
>
> The above code will print 0, even though we clearly had a division by
> zero. After all, the If statement in the error handler executed
> successfully.
> I think this is one of the few cases where On Error Resume Next makes
> sense:
> Dim x As Integer
> On Error Resume Next
> x = 1 / 0
> Debug.Print Err.Number
> if Err.Number = 11 then Msgbox "Arrrccchhh"
>
> -Tom.
> Microsoft Access MVP
>
>
> >I tried to use the below code from a post by Joan Wild and it does not work.
> >I placed the code on the open event of my main switchboard form.
> >
> >The VBA compiler did not like the line
> >
> >Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(), "")
> >
> >If the user has a password, you get error 3029. Not a valid account name or
> >password.
> >
> >So I added an On Error event to try to capture the error. This does not
> >work either.
> >Whether the user has a blank or a valid password, the err that is returned
> >is always zero. I check the code by changing my password from blank to a
> >valid password through the Tools menu.
> >
> >I have included my new code at the bottom of this post.
> >
> >Thank you for your time.
> >
> >"Joan Wild" wrote:
> >
> >> You can try to open a new workspace, passing CurrentUser() as the username
> >> and "" as the password.
> >> If you don't get an error, then the "" password is correct, and they have a
> >> blank password.
> >>
> >> Dim ws as Workspace
> >> Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(),"")
> >> If Err=0 then
> >> 'they have a blank password
> >> 'open a form for them to change their password
> >> Else
> >> 'they don't have a blank password
> >> 'do nothing
> >> End If
> >>
> >>
> >> --
> >> Joan Wild
> >> Microsoft Access MVP

> >
> >New code I tried.
> >
> >Dim ws As Workspace
> >
> >On Error GoTo ErrLogin
> >
> >Set ws = CreateWorkspace("tempws", CurrentUser(), "")
> >Debug.Print CurrentUser()
> >Debug.Print err.number
> >If err = 0 Then
> > Stop
> > 'users password is not blank
> >Else
> > Stop
> > 'users has a blank password
> >End If
> >
> >ErrLogin:
> > If err.number = 3029 Then
> > Resume Next
> > End If

>

 
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
Determining if a user has a non-blank password =?Utf-8?B?Q2h1Y2sgVw==?= Microsoft Access Security 2 6th Aug 2009 03:48 AM
Acrobat Standard 7 on Citrix giving users a blank blue screen KingCronos Microsoft Windows 2000 Terminal Server Clients 2 29th Jun 2006 12:42 PM
See which users have blank password =?Utf-8?B?VHJvcGVy?= Microsoft Windows 2000 Active Directory 4 30th Jan 2006 01:34 PM
!! Firewall incorrectly determining DOMAIN/Standard - since last WU? RJ Windows XP Networking 1 11th Jan 2005 08:15 PM
!! Firewall incorrectly determining DOMAIN/Standard - since last WU? RJ Windows XP General 1 11th Jan 2005 08:15 PM


Features
 

Advertising
 

Newsgroups
 


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