Results 1 to 2 of 2
  1. #1
    Tari is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Posts
    36

    Question Basic security question


    Hey,

    I have 0 clue about access restriction in Access and I'm facing the following challenege:

    I recently implemented a database for purchase requisitions. Our users open the database, fill out a form with details about their purchase and print it after they are done.

    I want to be able to limit their access after it was created, so that they can not go back in and delete it, or change anything on that RTP. But I have to be able to go back in and make changes as I please.

    Is that possible? If yes, how do I do that?

    Thanks so much for the help!

    Tari

  2. #2
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    Yes. I do this all the time. There are several different approaches. Here's one technique that I use: https://www.accessforums.net/code-re...mple-7538.html

    It basically involves setting up a 'user' table with two fields: loginID (text) and an Admin field (Yes/No). Then there is a function in the "Is User Admin" module called: isAdmin which can be called to see if the current user is an admin user or not. It does this by looking up if the Admin field is Yes in the 'user' table for the matching getUser(). (see note below).

    Note: This technique also uses the getUser() function which is used to retrieve the current user's loginID. Great for saving as a default (ie. = GetUser()) in a field (on a form) into a field called: EnteredBy which is in your main data table. Then you know 'who' entered the record. I will also add another field called: DateEntered and set the default value of this field (on the form) to =Now().

    Using isAdmin example:

    if isadmin(getUser()) = false then
    msgbox "You do not have admin permissions to ....."
    exit sub
    end if

    Thus, in your button vba code to open the form, you can set the form's locked for edits property to yes or no depending upon what is returned in the isAdmin function.
    example:
    Docmd.openform "myDataForm"
    if isAdmin(getUser()) = true then
    Forms!myDataForm.AllowEdits = true
    else
    Forms!myDataForm.AllowEdits = false
    end if

    I make myDataForm a modal/popup type form so user's cannot access the top MSAccess menus. (I make all my forms modal/popup forms except the background form - this way I can prevent users from clicking where they shouldn't be and I control the 'flow' of the app.) You may also want to make your data forms popup = yes and modal = yes to prevent users from clicking astray (and then put a close button on it for them to close or they can use the upper right x). I would have a field in the table which indicated the PO was 'lockedbyUser' which indicated that a user confirmed locking the record and they were done editing (I prompted for this on close or had a checkbox on the form.)

    2. Another method for locking data tables from users deals with MSAccess permissions itself. But if you're going to have some users who will need permissions to edit a table for new records but not existing, I wouldn't recommend this route. You'd have to have them login as different logins or keep messing with their permissions.

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

Similar Threads

  1. basic (sorry) question
    By wokeeffe in forum Database Design
    Replies: 1
    Last Post: 12-21-2010, 11:20 AM
  2. Basic Question
    By Dalagrath in forum Forms
    Replies: 12
    Last Post: 10-31-2010, 05:36 AM
  3. Security question
    By maxx3 in forum Security
    Replies: 2
    Last Post: 01-14-2010, 05:27 PM
  4. Really basic question
    By jimlaw in forum Forms
    Replies: 1
    Last Post: 07-27-2009, 07:20 AM
  5. Basic Question
    By chris11590 in forum Forms
    Replies: 0
    Last Post: 08-04-2008, 05:57 AM

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