Results 1 to 5 of 5

Thread: Hiding a button

  1. #1
    Join Date
    Jun 2005
    Posts
    102

    Unanswered: Hiding a button

    Ok, I have this form that shows a command button called Administration. How do I hide the button when the form is open by a user with no administrative privilage. Example, when currentuser() is Admin, show the button but when currectuser() is Guest, hide the button.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Hi rodrunner
    you need to query the workgroup to see if that user has is a member of a specific usergroup

    A word of caution it doens't look as if you have followed the steps to correctly secure your access application(s). A user opening access without explicitly entering a password will always have an access userid [currentuser()] of admin. if the reisntall access they will have admin as thier accessuserid

    before deploying security read up fully on the issues before doing anything.


    regrading actual permissions, the trick is to assign users to a usergroup (or usergroups) and then query if that person is a member of that user group.

    One technique of assigning the permissions is to remove all permissions from the admin user - so if someone connects with a default wrokgroup they have no access to your application. define users using the network user id (available form the API [google: dev ashish api]) and search for that users id - that way round it doesn't matter what that users connects with their privilege is defined by the manner they signed on to the network, not access. bear in mind that network security is theoretically mor esecure than access security (ie the netwsork will handle validation & authentication - it means that yur users will not have to remember yet another f!!g password.

    first off re-read the bumpf on securing your application
    HTH

  3. #3
    Join Date
    Jun 2005
    Posts
    102
    Quote Originally Posted by healdem
    Hi rodrunner
    you need to query the workgroup to see if that user has is a member of a specific usergroup

    A word of caution it doens't look as if you have followed the steps to correctly secure your access application(s). A user opening access without explicitly entering a password will always have an access userid [currentuser()] of admin. if the reisntall access they will have admin as thier accessuserid

    before deploying security read up fully on the issues before doing anything.


    regrading actual permissions, the trick is to assign users to a usergroup (or usergroups) and then query if that person is a member of that user group.

    One technique of assigning the permissions is to remove all permissions from
    the admin user - so if someone connects with a default wrokgroup they have no access to your application. define users using the network user id (available form the API [google: dev ashish api]) and search for that users id - that way round it doesn't matter what that users connects with their privilege is defined by the manner they signed on to the network, not access. bear in mind that network security is theoretically mor esecure than access security (ie the netwsork will handle validation & authentication - it means that yur users will not have to remember yet another f!!g password.

    first off re-read the bumpf on securing your application
    HTH
    What I stated on the original POST was an example, I already have the security setup, I was just using Admin as a reference (Admin could have been any user with admin access to the database). I just want to know how to hide the button if it's a user with no admin rights login in. Just give me the code. Because I don't know the VB code to hide objects.

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Permissions

    Attached is a sample which may help you out. Let me know if it does.
    Attached Files Attached Files
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if currentuser()="admin" then
    mycommandbutton.visible=true
    else
    mycommandbutton.visible=false
    endif
    however that only works for am Access userid="Admin"

    I note PKStormy has added something, I've included the persmissions moduel I use- this version uses the currentuser function in the haspermissions. basically you call the module with the usergroup you want. effectively does this person have permission for the follwoing groups.

    BTW it includes most of Dev Ashish's API calls. The main functions are haspermission, getuser, getcomputer
    HTH
    Attached Files Attached Files

Posting Permissions

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