Results 1 to 8 of 8
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Apply Settings to ALL forms, Reports

    Can I use my code, let's say a user logins in with data settings, meaning they can enter data. How would I go about setting the forms so they could Not delete or change any data?


    Another example would be if a user was given a Read Only status upon login, I could do this individually for each and every form of course but is there not a way to do a select all and then apply my security settings?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Handle this when form is called to be opened.

    Use the DataMode argument of DoCmd.OpenForm, something like:

    DoCmd.OpenForm "formname", , , , IIf(userStatus="ReadOnly", acFormReadOnly, acFormPropertySettings)

    userStatus could be a global variable or reference to a textbox on a form that is always open.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    That sounds good, except would I not have to do this in a module? Or do it for every form?
    My security settings are defined via my table and for example a user with read only privileges would have their table setting as reado

    I dont want to have to do this for every user and every form and or report. I will have to have a way to automate this for sure! I am thinking a module for sure!
    How would I call this in a global variable?

    User has Read Only Settings which mean the table value will be reado so I want to make all forms Read Only. How would I call this?

    If tblUserSecurity_Sec = [reado] = True Then
    acFormReadOnly, acFormPropertySettings

  4. #4
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Ok, a little more refined; Now if this is true, then I need to set ALL forms as Read Only. Since I wont be there in person this will have to be automated. All I need now is the code to set to read only for ALL forms. Then I can step thru this in a module I assume and set according to user rights. What type of module and how do I call it? Simply type Call Something from where? I have never written a module before.

    If DLookup("[reado]", "tblUserSecurity_Sec", "[userID]='" & Me.txtUserID.Value & "'") = -1 Then
    strSecLvl = "Read Only"
    End If

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    That would require setting AllowEdits and AllowDeletions properties. I have never done this and don't know if that can be done if form not opened in Design View. Just write code to open form in appropriate mode.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Not the answer I was hoping for. But can't win em all. I will trudge thru this as best I can and even though I succeed I still have no guarantee of security, bummer! I suppose I could do a bunch of If IsLoaded statements???

    Thanks,

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Don't understand. Why would IsLoaded be useful?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    That would tell me if the form was loaded or not. Then I could alter the code a End If.It's a mute point now of course unless I have some kind of giant brain fart.
    Command6.Enabled = CurrentProject.AllForms("Customers").IsLoaded something like that is what i use for my zip codes form.

    Thanks,
    Mark as solved and move on.. Thank You!

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

Similar Threads

  1. Replies: 4
    Last Post: 12-22-2012, 07:14 PM
  2. Reports and Forms
    By GaryG73 in forum Access
    Replies: 3
    Last Post: 11-21-2011, 11:45 AM
  3. reports to forms to queries
    By aaa1 in forum Forms
    Replies: 9
    Last Post: 08-10-2011, 07:29 PM
  4. Forms and reports
    By g2rules in forum Access
    Replies: 0
    Last Post: 03-08-2011, 09:09 AM
  5. Forms and Reports
    By nacho in forum Forms
    Replies: 3
    Last Post: 04-17-2010, 01:06 AM

Tags for this Thread

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