Solved

Open/close Navigation Pane programatically via vbscript

Posted on 2010-08-24
8
1,415 Views
Last Modified: 2013-11-29
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.
0
Comment
Question by:yvroger
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 18

Expert Comment

by:Cluskitt
ID: 33511717
0
 

Author Comment

by:yvroger
ID: 33511904
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...
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 33511949
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
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 100 total points
ID: 33513136
Did this code ever work?

What is "RS()", and where are you declaring it?

Is this DB split?
Is this code in the front end or the back end?

Perhaps I am misunderstanding something though.

This very basic example works fine for me:

Sample attached
Database18.mdb
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33513150
You can obviously modify this to fit your specific log on security system...
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 400 total points
ID: 33513199
you need more codes




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

oAccess.Visible=true
oAccess.UserControl=true
   
    If RS("Role") = "Administrator" Then
            oAccess.DoCmd.SelectObject acTable, , True
           
    Else
            oAccess.DoCmd.SelectObject acTable, , True
            oAccess.DoCmd.RunCommand acCmdWindowHide
           
    End If



just post back the result..



0
 

Author Closing Comment

by:yvroger
ID: 33514510
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.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33514561
Hey, as long as you got your issue resolved, then it's all good.

;-)

Jeff
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now