numeriss
asked on
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
Why not just make seperate shorctuts and launch from there?
ASKER
I used this code
dbl = Shell("msaccess """ & CurrentDb.Name & """ /WRKGRP """ & DBEngine.SystemDB & """" & IIf(IsExclusive, " /EXCL", ""), vbMaximizedFocus)
If dbl Then DoCmd.RunCommand acCmdExit
dbl = Shell("msaccess """ & CurrentDb.Name & """ /WRKGRP """ & DBEngine.SystemDB & """" & IIf(IsExclusive, " /EXCL", ""), vbMaximizedFocus)
If dbl Then DoCmd.RunCommand acCmdExit
Option Compare Database
Option Explicit
Sub OpenDBWithNewWorkgroupFile
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(PathToDat
'execute your inline SQL here
End Sub
Steve