Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Open/close Navigation Pane programatically via vbscript

Posted on 2010-08-24
8
Medium Priority
?
1,438 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 400 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 1600 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

722 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