Password to Enter Data for users

rlangford

Registered User.
Local time
Today, 01:18
Joined
Feb 5, 2014
Messages
17
Hello all, I am trying to set up a password on a for different users to have to enter pins to enter data. When a user selects his/her name from the combo box the next field will be something like pin. When they enter the corresponding pin this will allow them to edit and start or continue (if they left) fill out the rest of this form. The reason being this way is that if one of them goes back to a previous record done by another user (which I want them to be able to view) they can view it but cannot edit it because they do not have the users pin (or password). Is this able to be done, only allowed to edit or create a new record if you enter your pin every time.
I feel like its possible but I have no idea how to start. As always thanks all!
 
Rather than complicate things, why not just just stamp the user id on the record created and then put a little bit of code in to determine when, opening the record in a form (On Current event), if the current user can edit or view?

Handy code for getting user name right here -> http://access.mvps.org/access/api/api0008.htm
 
I'm new to VBA but am starting to get this however this doesn't make sense to me. What does it mean to stamp the user ID on the record? And would the user ID be different than just the users name (initials)? A little more explanation would greatly help thanks so much.

:banghead:

Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If ( lngX > 0 ) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
 
you can get the asame info simply by

environ("username")

have a control on your form (hidden, or just not enabled), and in the beforeupdate event for the form put

usercontrol = environ("username")

as mile-o says, you can take this as far as you want. you can record the date and time of the orginal entry and the name of the originator, and the last amendment details as well- or indeed audit every change if you like.

you can use this information and any other information to determine the edit status of the record.

you can do this instead by requiring the entry of "pin numbers" but it isn't so easy as you need a way of issuing and controlling the pin numbers, and stuff like that tends to not stay private for long.

The more you want, the more complex it is.
 
What does it mean to stamp the user ID on the record? And would the user ID be different than just the users name (initials)?
When I create tables I tend to add six fields to their end. These are:

  • DateCreated
  • UserCreated
  • DateUpdated
  • UserUpdated
  • DateExpired
  • UserExpired

When someone creates a new record I put the data and the user's Windows ID into the DateCreated and UserCreated fields respecively. When an update happens, the DateUpdated and UserUpdated fields. And, rather than actually delete records, I prefer to store the data and user that 'deleted' records.
 

Users who are viewing this thread

Back
Top Bottom