Lots of people don't use the built-in Access security and just build their
own security using a user and usergroup tables.
You can then prompt for login using a simple form and control access,
navigation or most anything you want through code.
Pros and cons both ways. users are individuals and they belong to a user
group such as "Admin", "sales", "marketing" etc...
and security is controlled at the user group level. You can also use the
windows login for automatic login if you want to go an extra level.
You could see an example of this type of setup and sample code in the
documentation of the CRM template on
www.rptsoftware.com.
The code is pretty simple.
Wasn't sure if you already made the choice for using real Access security or
not?
HTH,
Mark
------------------------------
Example code in password form:
------------------------------
Private Sub cmdSubmitSecurity_Click()
On Error GoTo Err_cmdSubmitSecurity_Click
'checks to see if user entered a valid username/password
'if so the global variable "globalSecurityGroup is set and
'frmAccountsmain form is opened
Dim sPswd As String
If IsNull(Me.txtUsername) = True Or IsNull(Me.txtPassword) = True Then
MsgBox "Please enter both a userid and password"
Exit Sub
End If
'DLOOKUP returns null if no record found therefore give it a default
value of ""
sPswd = Nz(DLookup("Password", "tblUser", "Username='" & Me.txtUsername
& "'"), "")
If Me.txtPassword <> sPswd Then
MsgBox "Invalid UserID/Password combination"
Exit Sub
Else
'assign current users username and security group to global
variables
'this variable can then be used in forms to control security in
various ways
globalSecurityUser = Me.txtUsername
globalSecurityGroup = Nz(DLookup("GroupName", "qryUserGroup",
"Username='" & Me.txtUsername & "'"), "")
'Good security close form and open main accounts form
DoCmd.Close acForm, "frmPassword"
DoCmd.OpenForm "frmMain", , , , , acWindowNormal
End If
Exit_cmdSubmitSecurity_Click:
Exit Sub
Err_cmdSubmitSecurity_Click:
MsgBox Err.Description
Resume Exit_cmdSubmitSecurity_Click
End Sub