PDA

View Full Version : check if Access file is open and who the userID is



alienscript
09-18-2007, 08:06 AM
Hi the gurus,

In my automation task, I was able to check if an XLS file is in use and then alert the users of the username or ID before Exit Sub. I learned it from this page "http://www.xcelfiles.com/IsFileOpenVBA.htm". However, it wasnt successful when my VB procedure using ADO method to run queries and macros in two Access databases and to import correct data back to my worksheet. This was because the user was in use of the databases.

What I want is some similar code that can also check if a mdb database is in use and alert with a msgbox of who the user is (name or ID). This is because the report scheduled to run on a certain time of the day is crucial to decision-making. With username being identified, he/she can be notified to exit the database. Any help is greatly appreciated and thanks very much.

Oorang
09-19-2007, 05:49 AM
http://support.microsoft.com/kb/198755

If it doesn't have an mdw you'll need to use the computer name.

alienscript
09-19-2007, 07:55 AM
Thanks for the MS KB. I will try to use Error Handler that if executing query in mdb failed, to display current list of users in use of the database & a msg string. Not sure if that will work. Will post back.