Results 1 to 3 of 3
  1. #1
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202

    Navigation tabs on sub naviation form disable based on security

    Good afternoon, I have a db in which access to specific tabs is based on security levels. The db opens with a Navigation form [frmNavMain]. I am using a LogIn form in which I have built VBA code to allow access to specific tabs based on their security level. Works great! My problem now is that within [frmNavMain], I have a subNavigation form [frmMain]. There are tabs on subform [frmMain] that I would like to disable based on the employee's security level. I have attempted multiple times and am having the same problem in that VBA cannot find the tab "navMagAll". I am getting runtime error 2465 with "can't find the field 'navMagAll" referred to in your expression. Below is a short version of my code. The code fore the tabs on the [frmNavMain] are coded correctly and working perfectly. The last line is for the subform [frmMain]. Any help would be appreciated.



    Case 3 'Manager
    Forms![frmNavMain]!navHome.Enabled = True
    Forms![frmNavMain]!navUserInfo.Enabled = True
    Forms![frmNavMain]!navEmployees.Enabled = True
    Forms![frmNavMain]!navCert.Enabled = True
    Forms![frmNavMain]!navTA.Enabled = True
    Forms![frmNavMain]!navMag.Enabled = True
    Forms![frmNavMain]!navAdmin.Enabled = False
    Forms![frmNavMain]!navExtra.Enabled = True
    Forms![frmNavMain]!NavClose.Enabled = True
    Forms![frmNavMain]![frmMain].[Form]!navMagAll.Enabled = False

  2. #2
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202
    So, here is a little more info. Part of my problem is that I am trying to switch from sql to vba mode. driving me crazy. If I use sql, it looks for the name of the navigation form [frmMain]. When using VBA, it is looking for the actual subforms [frmNavMagBase] I think the tabs are not attached to the subform you are trying to open with the tab. I think they are like "command buttons" in the subform that will open and display the subform attached to that tab/"command button". With that premise, I tried
    Forms![frmNavMain]![frmNavMagBase].[Form]!navMagAll.Enabled = False and it returns "can't find the field "frmNavMagBase" referred to in your expression."


    Opening form: frmNavMain (this contains 9 tabs)
    subfrm1: frmNavMagBase (this contains 2 tabs) the tab "navMagAll" is the tab I would like to disable.

    I'm not sure if I am going down the right path with this one.

  3. #3
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202
    Solution: I decided to work from the premise above and did the vba on the On Load for the subform. If the form is open then using the "frmMain" and not the subforms. Go figure. So confusing!!! I was hoping that the tab was used as a "command button" It worked! not quite sure why I cannot put it in the LonIn form and target the tab/command button, but I did a work around. code was as follows and hope this will help someone else.

    Private Sub Form_Load()
    If Forms![frmNavMain]![txtSecurityLevelID] > 2 Then
    [Forms]![frmNavMain]![frmMain].[Form]![navMagAll].Enabled = False
    End If
    End Sub

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

Similar Threads

  1. Navigation Form Tabs
    By RayMilhon in forum Forms
    Replies: 3
    Last Post: 08-11-2016, 02:50 AM
  2. Navigation Tabs. Linking
    By Bentley in forum Forms
    Replies: 2
    Last Post: 06-29-2016, 04:40 PM
  3. Replies: 4
    Last Post: 07-20-2015, 07:11 AM
  4. Replies: 12
    Last Post: 10-23-2014, 02:08 AM
  5. Replies: 2
    Last Post: 01-15-2011, 10:56 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