Results 1 to 6 of 6
  1. #1
    Join Date
    May 2003
    Location
    UK
    Posts
    233

    Unanswered: SQL linked to labels

    I have a form that is my main menu. From the menu you can get to other parts of the program by clicking on labels. You access the Main menu from a user log on screen user name is stored. By default all labels are not visible. Users are assigned groups in a grp_members table. What I want to do is make he labels visible if the user logging on is a member of that group.

    2 tables involved user_log and grp_members. The user log holds one record only(table held locally) grp_members holds all users and the groups they are assigned to.

    I have SQL that will identify if the user is a member of each group. This could run for each label. If the result is true then make label visible. I have a problem getting the SQL in the form to link this to a label.

    SQL = "SELECT Grp_Members.Group
    FROM user_log INNER JOIN Grp_Members ON user_log.user = Grp_Members.User WHERE (((Grp_Members.Group)='Admin'));"

    Any ideas?

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Not too surprising that you can't link SQL to a label. Text boxes can use SQL though. But I would be using VBA to set the visible property to true if the logged in user is part of the required group.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    May 2003
    Location
    UK
    Posts
    233
    Ok that sounds good to me - I still have the question - how can I link it to a text box?

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    By using functions in the Control Source of the text box. It would be a pretty complex Control Source though... I think... very hard to get specific here as I don't know the details of your login procedure.

    I'd still be going down the avenue of using VBA to enable only those labels the logged in user should have access to.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I suggest that when the form loads you go looking for the users permissions using a recordset or *shudder* a domain lookup function.

    Then based on the result you can set the properties.

    I don't think you should be using bound controls to do this.
    George
    Home | Blog

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    What?.... you mean using VBA to enable only those labels the logged in user should have access to?? Wow, that is so clever! ^^
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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