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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need vb Code to verify databse is exclusive

Status
Not open for further replies.

DavidWill

Technical User
Jan 2, 2002
8
US
Hi All,

Can anyone please provide a small sample of code to verify if the database I have open in Access 2002 is opened in exclusive mode.

Thanks in advance for the help.
Dave
 
How would you see this being useful?
If you succesfully opened the database in Exclusive mode then you retain exclusive mode.
If you succesfully opened the database in Shared mode, you will not get into Exclusive mode until try to do something that requires it, so you can't test for it before you attempt that action (because you are still in Shared mode).
 
I have a shared database that 10 users input orders into. At the end of the year I want to archive the past years orders into a spreadsheet and delete the records from the database. Unfortantely the admin user is not very good at enforcing that all users logoff wnen this process is started. So I either have to try and lock all the records or open the database in exclusive mode to make sure that no other users have a record called up that I want to archive. I thought I would check the open mode in the VB code before the process starts. Is there an easier way?

 
You could create a macro to do the job.
Then use windows scheduler to open the database and run that macro at a time when there will be no users. The command line allows you to specify the macro name to run.
Include a Quit database action in the macro to shut everything down again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top