Change Current User

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.
numerissAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AngelinoMCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stevbeCommented:
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
numerissAuthor Commented:
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
stevbeCommented:
Why not just make seperate shorctuts and launch from there?

0
numerissAuthor Commented:
I used this code

    dbl = Shell("msaccess """ & CurrentDb.Name & """ /WRKGRP """ & DBEngine.SystemDB & """" & IIf(IsExclusive, " /EXCL", ""), vbMaximizedFocus)
    If dbl Then DoCmd.RunCommand acCmdExit
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.