Solved

Open/close Navigation Pane programatically via vbscript

Posted on 2010-08-24
8
1,431 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
LVL 74

Expert Comment

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

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses
Course of the Month3 days, 15 hours left to enroll

630 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