Results 1 to 15 of 15
  1. #1
    atom is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    43

    Multiuser login form

    I'm thinking of creating a login form , where user enters username and password before login.

    I know that this can be done through a table with all needed information and according to that open a spesific form.


    But how about user level permissions?

    I have read that this can be done by creating .mdb files but then I can't open a form based on what user has logged in.

    Is there a way to combine those two parameters I need?

    I am using Access 2007

    Thank you in advance

  2. #2
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    I have enclosed a sample of how to create a login, in order to control user level permissions do you want it to open a different form for different people who login? or hide/show certain elements of it?

    I hope it helps a little!

  3. #3
    atom is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    43
    Thank you very much!
    About user level permissions both would work ( open different form / show-hide certain elements on switchboard)
    What would be the safest way?

  4. #4
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    You're welcome, I personally prefer to show/hide items as it means if i make a change I only really have to worry about one form. I have uploaded a new example using 'roles' to control who gets to see what.

    There is another method I use which doesnt require directly logging into the database as such, I use a getnetuser() function someone wrote (I forget who otherwise I would credit you and link to your great work!) to get the username of the person logged into the machine running the file and compare it to a similar table to that in the example.
    If their username doesnt show up, then all their permissions are set to "No" giving them read only access to my database, but that could be modified to prevent entry.

    Apologies for the wall of text!

    Safest is either really, because if you can break in to show objects, you can probably also break in to show the database window anyway and just bypass any security you have anyway.

    I would try to explain a bit better but generally I overcomplicate things so I try to keep it short and sweet!

  5. #5
    atom is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    43
    That works great!
    I never thought of this way using forms-queries..
    Very nicely done thank you a lot!

  6. #6
    atom is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    43
    Please tell me , can I use the above method using a switchboard and if yes how?

  7. #7
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Yes you can, you would have to modify the vb code (and copy it to your swtichboard).

    Firstly, set all controls that you want hidden via properties to visible=no.

    Then open the code builder and add the lines for the option and the label you wish to be viewed under the role ="yes" then section e.g.

    Code:
     
    Private Sub Form_Open(Cancel As Integer)
    If [Forms]![userpermissions]![role1] = "Yes" Then
    option1.visible=true
    Label1.Visible = True
    End If
    If [Forms]![userpermissions]![role2] = "Yes" Then
    option2.visible=true
    Label2.Visible = True
    End If
    End Sub
    Hope that helps!

  8. #8
    atom is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    43
    I think I should convert first switchboard's macros to vba .
    As far as I can see this is a bit complicated.
    I'll stick with the form (the only problem here is that I can't disable right click->close , so that the form always stays open) and if problems occur I will try switchboard

  9. #9
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    You dont have to convert the macros to vb (although for performance they are more efficient) all this does is hide the controls, and since if you cant see the controls you cant click them you're safe.

    As for disabling the right click-close, do you mean for the switchboard? the user permissions form should open hidden so they can't see it.
    You could use a macro/vb so when you navigate away, the script hides it, and then only make it visible if you navigate back.

  10. #10
    atom is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    43
    I'm trying to figure out how to make this via switchboard.
    The switchboard has onOpen property embedded macro .
    How can I add vba code too?

  11. #11
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Its an either/or for macros and vb, the good news is you can do anything you can with a macro in vb.

    If you would like it translating, although im not amazing at vb, i can do most things, so if you post the macro, i'll gladly give it an attempt at translation

  12. #12
    atom is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    43
    I have attached the macros that are running on_Open

    Sir, I thank you so much

  13. #13
    atom is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    43
    One additional information ,the switchboard was generated by Switchboard manager.
    So this is not a custom made form ,acting like a switchboard

  14. #14
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Sorry for taking so long, Spent spent ages trying to find my access 2007 disc (i most use 2003 since its what we have at work) and unfortunately the set tempvar command isnt available there (since i dont use it normally i cant even remember how to use it), however i do have an alternative now i have thought about it, you could instead of running the vb code on the on_open event, try running it on the on_activate.

  15. #15
    atom is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    43
    Great! I appreciate your help
    I will try it at evening and post back
    Thank you

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 02-22-2013, 11:28 PM
  2. Login form with nt login
    By hitesh_asrani_j in forum Forms
    Replies: 6
    Last Post: 09-22-2011, 11:43 AM
  3. MultiUser DB ... Some users can't update tables
    By gopherking in forum Programming
    Replies: 1
    Last Post: 08-24-2011, 08:01 AM
  4. multiuser for access database
    By cupidleomanoj in forum Access
    Replies: 4
    Last Post: 09-28-2010, 10:49 PM
  5. Error 3045 in multiuser mdb App
    By marlan in forum Access
    Replies: 2
    Last Post: 06-22-2010, 04:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums