Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VBscript to close a password protected Access database

Status
Not open for further replies.

jhoop83

IS-IT--Management
Jun 1, 2010
2
US
I'm having a bit of a problem and I'm hoping someone can help me here.

Some users here are forgetting to close out of Access when they are finished with the databases, and it's causing problems when we try to compact and repair them. I was searching on here before and I found this VBscript coding:



strLDB = "C:\Docs\TT.ldb"
strMDB = "C:\Docs\TT.mdb"

Set FSO=CreateObject("Scripting.FileSystemObject")

If Not FSO.FileExists(strLDB) then
msgbox "Not open"
wscript.Quit
End If

set acApp=getobject(strMDB)

acApp.quit



I found it here:
I modified it and it does work, but some of our databases are password protected. I can't figure out a way to program that in here. Is there a way to put the password into this code so I can close those databases, or should I abandon this code and start over?
 
but if they have already opened the password protected database then you wont need credentials to close it?
 
This script will be running from the server, and when it runs and it discovers that the ldb file exists for the database, it attempts to close it. However, if the database is password protected, a prompt comes up asking for the password. I want the script to bypass the prompt automatically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top