Verify User-Group Level Password

G

Gaetan

Hi,

I'm looking for some VBA code that will enable me to verify if the password
entered in a textbox control on a startup form matches the User-Group Level
Password so that the user is allowed to have access to the Database window
(hidden at startup).

If the password is wrong, the database window stays hidden.

Anyone can help?

Thanks in advance!
 
T

Tom van Stiphout

On Thu, 28 Feb 2008 05:14:02 -0800, Gaetan

What do you mean with "User-Group Level Password"?
Are you talking about workgroup-level security?

-Tom.
 
T

Tom van Stiphout

On Thu, 28 Feb 2008 06:57:01 -0800, Gaetan

(precise language counts)
If you are using workgroup security, you can test if the logged-in
user (who didn't just enter the password, but also the username, as
distinct from the database password that only requires a password) is
a member of a security group:
Function IsUserMemberOfGroup_TSB(ByVal strWorkspace As String, ByVal
strUser As String, ByVal strGroup As String) As Boolean
' Comments : Determines if the named user is a member of the
specified group
' Parameters: strWorkspace - name of the workspace to use or ""
(blank string) for Workspaces(0)
' strUser - name of the user to check
' strGroup - group to check membership in'
' Returns : True-user is a member of group, false otherwise
'
Dim varTemp As Variant
Dim wrkTemp As Workspace

On Error GoTo PROC_ERR

If strWorkspace = "" Then
Set wrkTemp = DBEngine.Workspaces(0)
Else
Set wrkTemp = DBEngine.Workspaces(strWorkspace)
End If

varTemp = wrkTemp.Users(strUser).Groups(strGroup).Name
IsUserMemberOfGroup_TSB = True

PROC_EXIT:
Exit Function

PROC_ERR:
IsUserMemberOfGroup_TSB = False
Resume PROC_EXIT
End Function

-Tom.
 
G

Gaetan

I might not have been clear in my question.

I don't need to see if a user is part of a group but rather check if the
password entered is good or not.

I have a front-end database that contains linked tables from a data file
that resides on a network. The front-end is securised by a workgroup-level
security but I need to have the back-end (data) file to be accessed not by a
single group, but by a single user. To control this, I thought of having a
form load at startup requesting the user (who is the administrator) for his
workgroup-level security password and if correct, the database window is
displayed, or else it's hidden.

The problem is that I don't know how to check for the validity of the
password.

Can you help me?
 
B

BruceM

Create a group that contains a single user (and hope nothing ever happens to
that person). Create group permissions in the backend file giving full
permissions to that group. If the database is secured properly (I assume
you mean user-level security, the term by which it is most commonly known)
it will not be possible to open that file by double-clicking on it unless
you are joined to the security workgroup. Rather than changing the default
workgroup to the security workgroup, create a shortcut that opens Access and
joins the user to the security workgroup file for that Access session.
After ending the session the user will be joined to the default workgroup.
The shortcut is something like this:

"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" /user "gaetan"
/wrkgrp "\\ServerName\FolderName\SecureDB.mdw"

The first part is the full path to the Access executable file on the
computer. The user switch is optional, but may make it easier since the
username will be filled in at the password prompt. The wrkgrp switch is the
path to the security mdw file. The security mdw file idenitfies the user,
and the permissions are stored in the Access file. If you are teh user, the
mdw file identifes gaetan and passes that information to Access. Access has
the information that gaetan is a member of the Developer group, and that the
Developer group has full permissions. The shortcut opens the Access
program, but no files. The user uses File > Open to navigate to the Access
file and open it. This will bring the login prompt.

All of this assumes the backend is a mdb file.

The puzzling thing about what you are asking is that the database window and
the back end are entirely different things. You can use the Startup options
to allow or disallow the use of special keys such as F11 to display the
database window. If you disallow their use it is still possible to use the
Shift bypass key to bypass the startup options. The bypass key can be
enabled/disabled programatically. A Google groups search for "Access Shift
Bypass" (without the quotes) should turn up plenty of information. The
database window can be shown or not programatically. I can point you to the
Help topic: StartupShowDBWindow property
However, it involves creating a property, which I have not done, so I have
no further information about that.

To what end do you wish to allow a single user to see the database window,
if that is what you are asking?
 
D

Douglas J. Steele

Assuming that the database was properly secured, if the user didn't enter
the correct password, he/she will be unable to open the database.

If that's not what you're experiencing, it's probable you didn't secure the
database correctly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top