Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Change Current User

Posted on 2004-10-21
5
Medium Priority
?
267 Views
Last Modified: 2012-05-05
I would like to change the current of the DB, I know it's not possible to do it.

But what i'm trying to do is close the current Database and reopen it , is it possible to do this without closing Access and reopen it

Something i would like is close the current project (keeping an empty Access windows) an reopen the same with and now the new user logon.
0
Comment
Question by:numeriss
[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
  • 2
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
AngelinoM earned 2000 total points
ID: 12370832
Run a Shell command to first open your project as the new user and afterwards close the current connection. Result is the same but should have to be possible.
0
 
LVL 39

Expert Comment

by:stevbe
ID: 12372357
If you only need to be the "other user" to run a query or something then you could use the PrivDBEngine to log on to the same database as a different user ... the notes say it can be used to attach through a different workgroup but I think it will work just fine if you use the same one.

Option Compare Database
Option Explicit

Sub OpenDBWithNewWorkgroupFile(PathToFile As String, _
                               DefaultUser As String, _
                               DefaultPwd As String, _
                               PathToDatabase As String)
    ' This function uses the unsupported PrivDBEngine object to
    ' open a database using a different workgroup information file
    ' than the one being used as the default. You might do this if
    ' you want to access data that is in a secured database that uses
    ' a different workgroup information file.
   
    Dim dbe As PrivDBEngine
    Dim wrk As Workspace
    Dim dbs As Database
   
    ' Return a reference to a new instance of the PrivDBEngine object.
    Set dbe = New PrivDBEngine
    ' Set the SystemDB property to specify the workgroup file.
    dbe.SystemDB = PathToFile
    dbe.DefaultUser = DefaultUser
    dbe.DefaultPassword = DefaultPwd
    Set wrk = dbe.Workspaces(0)
    ' Open the secured database.
    Set dbs = wrk.OpenDatabase(PathToDatabase)
   
    'execute your inline SQL here
   
End Sub

Steve
0
 

Author Comment

by:numeriss
ID: 12372967
I fact I want to get access to my Forms and report but with another user, i want something like Fast User Switching in Windows XP hehe
0
 
LVL 39

Expert Comment

by:stevbe
ID: 12379514
Why not just make seperate shorctuts and launch from there?

0
 

Author Comment

by:numeriss
ID: 12380799
I used this code

    dbl = Shell("msaccess """ & CurrentDb.Name & """ /WRKGRP """ & DBEngine.SystemDB & """" & IIf(IsExclusive, " /EXCL", ""), vbMaximizedFocus)
    If dbl Then DoCmd.RunCommand acCmdExit
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

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…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

636 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