Link to home
Start Free TrialLog in
Avatar of yvroger
yvroger

asked on

Open/close Navigation Pane programatically via vbscript

Hello everyone,

I would like to hide the MS Access navigation pane to certain unauthorized users.  

Based on what I have been noticing, it seems like I can use: DoCmd.RunCommand acCmdWindowHide.  

How can I do it from a vbscript that was set up to create the database in the first place?

Thanks.
Avatar of Cluskitt
Cluskitt
Flag of Portugal image

Avatar of yvroger
yvroger

ASKER

let me see if i can orient you a little better.  In the vbscript, I created an object as follow:

Set oAccess = CreateObject("Access.Application")
oAccess.OpenCurrentDatabase (strDatabasePath)

Now that I have my object created, I wanted to know how the run the code below from a vbscript.
   
    If RS("Role") = "Administrator" Then
            DoCmd.SelectObject acTable, , True
           
    Else
            DoCmd.SelectObject acTable, , True
            DoCmd.RunCommand acCmdWindowHide
           
    End If

I know it would work from a code behind (vb editor) in MS Access but i am not sure how to integrate the object (oAccess) with the command DoCmd.SelectObject...
Avatar of Rey Obrero (Capricorn1)
try

Set oAccess = CreateObject("Access.Application")
oAccess.OpenCurrentDatabase (strDatabasePath)

   
    If RS("Role") = "Administrator" Then
            oAccess.DoCmd.SelectObject acTable, , True
           
    Else
            oAccess.DoCmd.SelectObject acTable, , True
            oAccess.DoCmd.RunCommand acCmdWindowHide
           
    End If
SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can obviously modify this to fit your specific log on security system...
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yvroger

ASKER

Capricorn1 had actually responded correctly the first time.  I just did not have a chance to post a feedback earlier.  The code was on a vbscript separate from the database itself.

Boag2000, I really appreciated the little database you posted that I can use to build on. So I gave you some of the points as well.

Thank you all for your prompt and very useful responses.
Hey, as long as you got your issue resolved, then it's all good.

;-)

Jeff