Subtabs visible even when tab is not visible (1 Viewer)

PaulA

Registered User.
Local time
Today, 19:55
Joined
Jul 17, 2001
Messages
416
Greetings, all -

I have an Access2016 shared DB with a primary navigation form. I have programmed so that users only see certain tabs depending on their security level (a field in their user record in the db). It seems that the first tab's subtabs are visible (accessible) even if the tab they are connected to is not visible. One has to click on the visible tab (even if only one is visible) if it's not the first tab of the navigation form.

This makes no sense. It defeats the security of the design, adds extra effort on the user and different user levels access certain tabs. There's no one tab that all use that could be first. It also effects the flow of the design for those who access many or all tabs.

What am I missing?

The code is simple. The following is a sample of a function that is called after the user logs in:

Code:
Public Function MainNavSecurity(UserLevel As Integer)
Select Case UserLevel
    Case 1  'Admin: all records access - no editing or deleting
            Forms![frmDatabaseMainNavigation]!navClinician.Visible = True
            Forms![frmDatabaseMainNavigation]!navAdministrative.Visible = True
            Forms![frmDatabaseMainNavigation]!navProgressNotes.Visible = True
            Forms![frmDatabaseMainNavigation]!navReports.Visible = True
            Forms![frmDatabaseMainNavigation]!NavClinical.Visible = True
            Forms![frmDatabaseMainNavigation]!navAudit.Visible = True
            Forms![frmDatabaseMainNavigation]!navAllTxRecords.Visible = True
            Forms![frmDatabaseMainNavigation]!navRecReq.Visible = True
                             
    Case 2  'Clinical-Tx Rec: Clinician Entry
            Forms![frmDatabaseMainNavigation]!navClinician.Visible = True
            Forms![frmDatabaseMainNavigation]!navAdministrative.Visible = False
            Forms![frmDatabaseMainNavigation]!navProgressNotes.Visible = False
            Forms![frmDatabaseMainNavigation]!navReports.Visible = False
            Forms![frmDatabaseMainNavigation]!NavClinical.Visible = False
            Forms![frmDatabaseMainNavigation]!navAudit.Visible = False
            Forms![frmDatabaseMainNavigation]!navAllTxRecords.Visible = False
            Forms![frmDatabaseMainNavigation]!navRecReq.Visible = False

Etc., etc.

Thanks for any ideas.
 

isladogs

MVP / VIP
Local time
Today, 19:55
Joined
Jan 14, 2017
Messages
18,300
It does make no sense and is because of code errors somewhere in your setup. The fact that you are using a 'navigation form' may be part of the issue. They are notoriously difficult to adapt & references to controls are done differently to other forms

Are each of the 'nav' items tabs?

First of all I suggest all items are hidden by default.
You could do this in the form design or possibly in a function run before user logs in e.g. in autoexec macro

Then use user level security to show one or more tabs where appropriate depending on the level. So for case 2, you only need one line
Code:
Forms![frmDatabaseMainNavigation]!navClinician.Visible = True

Is this code running from frmDatabaseMainNavigation?
If so, just use:
Code:
Me.navClinician.Visible = True
 

PaulA

Registered User.
Local time
Today, 19:55
Joined
Jul 17, 2001
Messages
416
Yes - each of the nav items is a tab. Perhaps it was an assumption that if a tab was rendered not visible, the subtabs would be as well.

I'll try having the subtabs not visible as well by default.

You're right about the navigation forms -

Thanks.
 

Users who are viewing this thread

Top Bottom