Macro needed on close of database file

stafire_18

Board Regular
Joined
Dec 8, 2004
Messages
162
i need a code that will run a macro when the database is closed. if you have one, will this work if the "X" in the very top right hand corner is selected? or just if it's attach to a command button? Right now i have this macro as an autoexec but found some errors when multiple users open up the mdb.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

VicRauch

Well-known Member
Joined
Mar 23, 2006
Messages
2,032
If you open a form that is hidden when the database opens, then as the database is closed, that form will be closed, thereby giving you (your application) that the database is closing. If you need to keep tract of how many people are signed on to the database, then you can keep count in a table as the form is opened and as it is closed. When closing and the table shows this to be the last person signed on, do whatever it is you need to do.
HTH
 

VicRauch

Well-known Member
Joined
Mar 23, 2006
Messages
2,032
A little more info in case you need it about multiple people being signed on at the same time. This was supplied by CT Witter in this thread

Check out these Microsoft KB Articles, depending on your Version:
2000
How to determine who is logged on to a database by using Microsoft Jet UserRoster in Access 2000
http://support.microsoft.com/kb/198755

XP(2002) or 2003:
How to determine who is logged on to a database by using Microsoft Jet UserRoster in Access 2002 or in Access 2003
http://support.microsoft.com/kb/285822

HTH,
CT
 

Forum statistics

Threads
1,136,927
Messages
5,678,621
Members
419,776
Latest member
mikelowski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top