Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2003
    Posts
    83

    Unanswered: need to restrict data based on the user

    Good morning,

    I want to restrict data in a table, based on the deptno column.
    If a userA is logged on, he should be able to see only his records for the 'deptno' that he belongs to, and the userB should only sees his records based on a column say deptno.

    I am not sure how to restrict the data based on the user, in a table.
    Any clue or ideas is greatly appreciated.

    Thanks in advance.

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    Create a user table and include a column for deptno which will include either their department number or a code like All that will give them full access. You can create a query that will show the list of departments to which they have access and do an inner join to your other queries, or you can change all of your existing queries to include only those where the department code matches that of user. The second solution may be difficult to implement the All option.

  3. #3
    Join Date
    Sep 2003
    Posts
    83

    need help in restricting data based on User

    Originally posted by jmrSudbury
    Create a user table and include a column for deptno which will include either their department number or a code like All that will give them full access. You can create a query that will show the list of departments to which they have access and do an inner join to your other queries, or you can change all of your existing queries to include only those where the department code matches that of user. The second solution may be difficult to implement the All option.
    I have created a user table and included the column for deptno. Then I created different queries for different users (there are only 5 users who uses this database), which is getting the right information. My question is now how do i display the form that is based on the queries to display differently for each user? Please advise.

  4. #4
    Join Date
    Feb 2004
    Location
    Washington
    Posts
    49
    If you check who the user is on the click event where the form is loaded, you can validate if the person can access the form. If they can't display a message tell them they can't access the form, or allow them to load the form.

    You can also use the form load event to check the user and enable or disable fields on the form based on access level.

    The CurrentUser function is very helpful, and you can use that to query the other tables you created. I have a module that displays different menu and toolbars based on who the user is.

    Sub SetStartUpOptions(o As Object)
    If gCurrentUser = "dbo" Or gCurrentGroup = "PRODUCTION CONTROL" Then
    o.MenuBar = ""
    o.Toolbar = ""
    Else
    o.MenuBar = "MyMenus"
    o.Toolbar = "MyShortcuts"
    End If
    Cathy

  5. #5
    Join Date
    Sep 2003
    Posts
    83
    Originally posted by csbaker
    If you check who the user is on the click event where the form is loaded, you can validate if the person can access the form. If they can't display a message tell them they can't access the form, or allow them to load the form.

    You can also use the form load event to check the user and enable or disable fields on the form based on access level.

    The CurrentUser function is very helpful, and you can use that to query the other tables you created. I have a module that displays different menu and toolbars based on who the user is.

    Sub SetStartUpOptions(o As Object)
    If gCurrentUser = "dbo" Or gCurrentGroup = "PRODUCTION CONTROL" Then
    o.MenuBar = ""
    o.Toolbar = ""
    Else
    o.MenuBar = "MyMenus"
    o.Toolbar = "MyShortcuts"
    End If

    Thanks Cathy, I will try that. The database is not secured, for this, I think I have to first to secure the database. I was wondering if there is any other way to this. Thanks.

  6. #6
    Join Date
    Feb 2004
    Location
    Washington
    Posts
    49
    Exactly what do you mean by secure it?
    Cathy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •