Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Security / May 2007

Tip: Looking for answers? Try searching our database.

Field Level

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cati - 01 May 2007 17:14 GMT
Can somebody help me? I have a database and 2 Tables.
One table keeps some information (tblMain))and another is for login.
I have a form to enter record (entry) data into tblMain called frmMain.
In Main Table I have also a field with keeps the username for the user that
addNew record.
When a modification needs for same record I need my procedure to much
UseName(actual loged) whith that is saved in and only then to allow to modify.
In other words: if "SmithP" is owner of a record only SmithP can modify it.
Scott McDaniel - 02 May 2007 01:41 GMT
>Can somebody help me? I have a database and 2 Tables.
>One table keeps some information (tblMain))and another is for login.
[quoted text clipped - 4 lines]
>UseName(actual loged) whith that is saved in and only then to allow to modify.
>In other words: if "SmithP" is owner of a record only SmithP can modify it.

You could basically "lock" your form if the current user is not the record's owner. You'd do this in the Form's Current
event, which fires every time you move in the recordset:

Sub Form_Current()
 Me.AllowEdits = Me.YourUserNameField = UserName
End Sub

This assumes that UserName is a variable containg the name of the currently logged-in user, or is a Function that
returns the same.

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
Milewskp - 02 May 2007 02:13 GMT
Use:
 Me.AllowEdits = (Me.UserNamefield = LogInName())

Public Function LogInName() As String
  'This function returns the current user's network log-in name (eg
MILEWSKP).
  'If the user name is longer than MaxLen, "" is returned.
 
  Dim s As String
  Dim L As Long       'Length of null terminated UserName string
  Const MaxLen As Integer = 999        'Max length of UserName - 1
 
  On Error GoTo UnexpectedError
 
  L = MaxLen
  s = Space(L)
  Call GetUserName(s, L)        'S = UserName & Null character; if
Len(UserName& Null) > MaxLen then S = zero or more blank
  LogInName = UCase(Left(s, L - 1))        'Strip off excess characters
 
End Function
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.