Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1443
  • Last Modified:

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.
0
yvroger
Asked:
yvroger
  • 3
  • 2
  • 2
  • +1
2 Solutions
 
yvrogerAuthor Commented:
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
 
Rey Obrero (Capricorn1)Commented:
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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
Jeffrey CoachmanCommented:
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
 
Jeffrey CoachmanCommented:
You can obviously modify this to fit your specific log on security system...
0
 
Rey Obrero (Capricorn1)Commented:
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
 
yvrogerAuthor Commented:
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
 
Jeffrey CoachmanCommented:
Hey, as long as you got your issue resolved, then it's all good.

;-)

Jeff
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now