User Accounts

D

dhstein

Can someone please point me to a link that would help with setting up user
accounts, and providing different forms to load based on the user login. I'm
sure this is a pretty big subject, so I just need a place to get started.
Thanks for any information you can provide
 
R

Roger Carlson

Download the Microsoft Security FAQ here:
http://support.microsoft.com/kb/207793/en-us. Read it through completely at
least 3 times before trying anything. Experiement on a back-up copy of your
database before doing it on the real thing. Make sure you give the default
"Admin" user minimal rights before deploying to the users.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
M

Mark Andrews

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
 

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