access security

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GANA1234
    New Member
    • Mar 2008
    • 5

    #1

    access security

    Hello all,

    I have a scenario where the database users can see all the records in the table/form but can only edit their records (which are relevant to them ,for example I have a field which stores the names of the users).

    In other words they should be able to edit only their records which is identified by their name field .

    Any ideas or suggestions ?

    Gana
  • jeffstl
    Recognized Expert Contributor
    • Feb 2008
    • 432

    #2
    Originally posted by GANA1234
    Hello all,

    I have a scenario where the database users can see all the records in the table/form but can only edit their records (which are relevant to them ,for example I have a field which stores the names of the users).

    In other words they should be able to edit only their records which is identified by their name field .

    Any ideas or suggestions ?

    Gana
    That will all come down to the query you use to pull up the relevant records.

    I am not sure how you are doing your binding or reading of the data but you will need to use the User Name to determine which records they can see.

    Hopefully you have a column in your table that identifies the relevant user? If not I am not sure how you would do this.

    [code=sql]
    Select * from MyRecords, MyUsers where MyUsers.user_na me = MyRecords.user_ name
    [/code]

    If you don't have a joining table like that you can just pass the user name into your query then

    [code=sql]
    Select * from MyRecords where user_name = '" & UserName & "'"
    [/code]

    Comment

    • GANA1234
      New Member
      • Mar 2008
      • 5

      #3
      Originally posted by jeffstl
      That will all come down to the query you use to pull up the relevant records.

      I am not sure how you are doing your binding or reading of the data but you will need to use the User Name to determine which records they can see.

      Hopefully you have a column in your table that identifies the relevant user? If not I am not sure how you would do this.

      [code=sql]
      Select * from MyRecords, MyUsers where MyUsers.user_na me = MyRecords.user_ name
      [/code]

      If you don't have a joining table like that you can just pass the user name into your query then

      [code=sql]
      Select * from MyRecords where user_name = '" & UserName & "'"
      [/code]
      Hi Jeffstl,

      Thanks for responding . I have a username field so as you said I want to restrict the users by username , so that a user with the same username as in the records can edit . Is the solution you gave applies ? But he should be able to see all the other records and edit only their records .

      Gana1234

      Comment

      Working...