Results 1 to 9 of 9
  1. #1
    rivereridanus is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    71

    Form doesn't filter on load if user has restricted access

    Hi everyone,

    I have a bit of a problem with my application, and I can't even pinpoint any code that gives me an error...
    I have a report that has a link to open a a form "ProjectDetailsActive" to a specific record ID from the report. It works.



    I have 3 subsets of users who have restricted access to the form "Project Details Active". By that I mean that when they open this form, it hides and rearranges some tabs, and disables certain controls. If a user from one of these 3 subsets tries to open the link to a specific record in the form, it does not work. The form opens to the first record available instead of the selected record. This is only a problem for these 3 user groups. For users who do not fall into these 3 groups, the filter works.

    This is the only code in the form that does the restriction, but I don't know where the process is going wrong.

    I'd appreciate any ideas at all!

    Code:
    Private Sub Form_Current()
        LoadBudgetPage
        CancelRsn.Enabled = False
    'detect number of line items for current project
    Me.lblOrderCount.Caption = GetNumRecords & " line items for this project."
    'For each project, enable ProdDate flag if DSR flag is set
    If DSR = True Then
        ProdDate.Enabled = True
    ElseIf DSR = False Then
        ProdDate.Enabled = False
    End If
        
    'For each project, check if locked (closed).
    'If locked, disable all fields, if not then Enable all fields.
    If Locked = False Then
        'Me.AllowAdditions = True
        'Me.AllowDeletions = True
        'Me.AllowEdits = True
        ProjName.Enabled = True
        ID.Enabled = True
        ReOpenProject.Visible = False
        lblClosed.Visible = False
        lblArchived.Visible = False
        Division.Enabled = True
        StDate.Enabled = True
        EndDate.Enabled = True
        ProjectSummary_Page.Enabled = True
        ProjectDetails_Page.Enabled = True
        ProjectHistory_Page.Enabled = True
        Me.Audit_subform.Locked = False
        Dependencies_Page.Enabled = True
        Me.Dependencies_subform1.Locked = False
        Me.Dependencies_subform2.Locked = False
        If Unpl = True Then
            Rsn4Unplanned.Enabled = True
            Pushbk.Enabled = False
        Else
           Rsn4Unplanned.Enabled = False
           Pushbk.Enabled = True
        End If
        If Pushbk = True Then
            Unpl.Enabled = False
        Else
            Unpl.Enabled = True
        End If
        If DeplOnly = True Then
            PriPlatform.Enabled = False
        Else
            PriPlatform.Enabled = True
        End If
    ElseIf Locked = True Then
        'Me.AllowAdditions = False
        'Me.AllowDeletions = False
        'Me.AllowEdits = False
        ProjName.Enabled = False
        ID.Enabled = False
        Division.Enabled = False
        StDate.Enabled = False
        EndDate.Enabled = False
        ProdDate.Enabled = False
        ProjectSummary_Page.Enabled = False
        ProjectDetails_Page.Enabled = False
        'ProjectHistory_Page.Enabled = False
        Me.Audit_subform.Locked = True
        'Dependencies_Page.Enabled = False
        Me.Dependencies_subform1.Locked = True
        Me.Dependencies_subform2.Locked = True
        If Archived = True Then
            lblClosed.Visible = False
            ReOpenProject.Visible = False
            lblArchived.Visible = True
        Else
            lblClosed.Visible = True
            ReOpenProject.Visible = True
            lblArchived.Visible = False
        End If
    End If
    
    'Check to see if user is Requester
    Dim CurrUser As Variant
    CurrUser = Environ("username")
    If IsNull(DLookup("[UserID]", "Users", "[UserID]=" & Chr(34) & CurrUser & Chr(34))) Then
        '  user not in USERS table. Hide Project tabs.
        RestrictTabs
        RestrictNonAdmin
    ElseIf Not IsNull(DLookup("[UserID]", "Users", "[PlatformOwner] = True AND [UserID]=" & Chr(34) & CurrUser & Chr(34))) Then
        'user is Platform Owner. Hide Project Tabs
        RestrictTabs
        RestrictNonAdmin
    ElseIf Not IsNull(DLookup("[UserID]", "Users", "[CFS] = True And [UserID]=" & Chr(34) & CurrUser & Chr(34))) Then
        'user is CFS. hide project tabs
        RestrictTabs
        RestrictNonAdmin
    End If
    End Sub
    
    
    Private Sub RestrictTabs()
        Me.ProjectSummary_Page.Enabled = False
        Me.ProjectDetails_Page.Enabled = False
        Me.Dependencies_Page.Visible = False
        Me.ProjectHistory_Page.Visible = False
        Me.Budget_Page.PageIndex = 0
        Me.Technology_Page.PageIndex = 1
        Me.ProjectSummary_Page.PageIndex = 2
        Me.ProjectDetails_Page.PageIndex = 3
    End Sub
    
    
    Private Sub RestrictNonAdmin()
        Me.ReOpenProject.Visible = False
        Me.cmdSaveRecord.Visible = False
        Me.cmdAddProject.Visible = False
        Me.ID.Enabled = False
        Me.ProjName.Enabled = False
        Me.Division.Enabled = False
        Me.StDate.Enabled = False
        Me.EndDate.Enabled = False
    End Sub

  2. #2
    rivereridanus is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    71
    I guess I'll mark this as solved, since I figured out the problem (even though I can't fix it).
    Here is the piece of restrictive code that was blocking the filter.
    I guess you can't rearrange the tab order and also expect a filter to work. Who kn

    Code:
    Me.Budget_Page.PageIndex = 0
        Me.Technology_Page.PageIndex = 1
        Me.ProjectSummary_Page.PageIndex = 2
        Me.ProjectDetails_Page.PageIndex = 3

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why were you trying to rearrange the tab order?

  4. #4
    rivereridanus is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    71
    Because each of my user groups follows a different business process, so the order in which they use the tabs is different. I was trying to rearrange the tabs in the correct order for their user group without having to make a duplicate form for each user group.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is this a TabControl you are working with?

  6. #6
    rivereridanus is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    71
    Yes, it is a form on which there is a tab control with 6 tabs (perhaps it is more correct to say there are 6 tab controls?). The Admin, and SuperAdmin groups see all 6, enabled, in the original order. My three other groups only see 4, two of which are disabled so they cannot make any changes, and (ideally) in a different order.
    I am still able to disable and/or hide tabs, but the problem only occurs when I rearrange them.
    It's not the end of the world, but it is a strange issue

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would think you could have another "row" of tabs and be able to hide the "row" that did not apply.

  8. #8
    rivereridanus is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    71
    Hey, that's a thought! I wouldn't have thought of doing that... Thanks

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Let us know how you make out.

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

Similar Threads

  1. Restricted Access - Admin v. User
    By need_help12 in forum Security
    Replies: 4
    Last Post: 04-30-2012, 09:51 AM
  2. Replies: 3
    Last Post: 08-23-2011, 04:35 PM
  3. filter records to populate form on load
    By rivereridanus in forum Forms
    Replies: 3
    Last Post: 08-05-2011, 08:54 AM
  4. user restricted query
    By adidashawn6 in forum Queries
    Replies: 1
    Last Post: 01-06-2011, 11:24 AM
  5. Form - Filter on load (if data exists)
    By dilbert in forum Forms
    Replies: 0
    Last Post: 08-13-2010, 11:39 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