Color scheme: Light
You are here: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » WKL Forms Object Library how-to guides » How to: Vary the navigation pane per environment

How to: Vary the navigation pane per environment

Show a group or an entry in the navigation pane only during development, only in the ACCDB file, or only to users the application allows.

Requires WKL Forms Object Library 1.50 or later.

Solution overview

Every group and entry in the model has a condition with three parts, all of which must hold, just like the ribbon commands: Profiles (the Linked Tables Manager's connection profile), the kind of file (ACCDB, ACCDE, or runtime), and Function (a public VBA function without arguments that returns True). Anything whose condition doesn't hold isn't written to the pane at all. Because conditions are evaluated when the model is applied, the application applies it at startup.

Implementation

In the navigation pane designer, on the Groups and entries page, select the group or entry and fill in Visible when, for example ACCDB for a group of development tables. Then apply the model every time the application starts, for example in the Load event of the startup form:

Private Sub Form_Load()
    Dim pane As Object
    Set pane = CreateObject("WklForms.NavPane")
    pane.Apply
End Sub

If the role comes from the sign-in, set it before you apply the model:

Public Function IsAdmin() As Boolean
    On Error Resume Next
    IsAdmin = Nz(TempVars("role"), "") = "Admin"
End Function
TempVars("role") = "Admin"
CreateObject("WklForms.NavPane").Apply

Remarks

  • The profile is the one set with WklNavPane.Profile or WklRibbon.Profile (the two share it); otherwise, it's the profile that most linked tables use (as with WklLinkManager.DetectEnvironment).
  • The build tool applies the model on the build computer, in an ACCDB file; an ACCDE file made from it carries that pane until the application applies the model itself.
  • Apply returns the entries whose objects don't exist in the database, one per line; it never shows a dialog box.
  • Hiding is a convenience, not security: an object left out of the pane can still be opened by code or by name.
en/wiki/msaccess/comctl/how-to/vary-the-navigation-pane-per-environment.txt · Last modified: by Wolfgang van der Stille