A little step forward !
I have placed a button on my form that OnClick launches an external restart.vbs file
The code for the restart.vbs file is as follows
Code:
dim accessApp
set accessApp = GetObject("G:\Database\MyDatabase.mdb")
accessApp.CloseCurrentDatabase
WScript.sleep 20000
accessApp.OpenCurrentDatabase("G:\Database\MyDatabase.mdb")
My trouble is that at restart the database is automatically re-opened using the same username and password : since my original purpose was switching the user, you can figure out how disturbing it is.
The only way to me to be reprompted for a new username and password is to use :
instead of
Code:
accessApp.CloseCurrentDatabase
... but this means you have to quit and restart the whole application (Access), not just the database (=more time needed).
Further, I have noticed that the ... :
Code:
accessApp.CloseCurrentDatabase
.... code deletes the .ldb file but not the .ldw file, so that's likely the reason for the fault.
The .ldb file, opened in notepad shows myself as the connected user, but the database is actually closed and no other user is connected !!! I have tried to remove the
accessApp.OpenCurrentDatabase("G:\Database\MyDatab ase.mdb")
code so that the .vbs was close-only, and also in this case the .ldb remained there. So it seems as a fault of the CloseCurrentDatabase function.
As you can see above I have also tried to add a long pause in the .vbs hoping this was enough for the .ldb to self-delete, but this didn't help.
How can I delete that f****d .ldb file ????