Adding username to table

  • Thread starter Thread starter PsyberFox
  • Start date Start date
P

PsyberFox

Hi there,

I've now read the security FAQ and succesfully set up security with users,
passwords, etc on my db. My db is form-driven with menu's, etc... running off
linked SQL tables. However, I have the following two questions:
1. How do I add the username per record added? and
2. How do I get around the error message when a user tries to open a form
that he/she has no permission to open?

Thank you in advance!
 
If you just want the username for when a record is added, put a field in your tables CreatedBy. Add the field to your form and set the textbox's default value to CurrentUser() (you can hide the textbox if you wish, or at least lock it).

For the second question, I would hide any button's that a user doesn't have permission for. In the open event for your menu form

If faq_IsUserInGroup("ReadOnly", CurrentUser) Then
Me.SomeCmdButton.Hidden = true
Me.SomethingElse.Hidden = true
End If

The faq_IsUserInGroup function can be found in the security FAQ.
http://support.microsoft.com/?id=207793
 
Back
Top