M
Martin
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.
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
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 said: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
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