|
Pacific Database |
|
| Home Company Services Employment Support Centre Events Contact Us | |
|
A world of information at your fingertips |
|
Access-specific :: Shutdown AccessShutdown the Access application using VBATo shutdown the Access application, you can use Application.Quit. The Quit method takes one optional parameter, which can be one of the following three AcQuitOption constants:
Shutdown the Access application using the Windows APIThe following function, created by Albert Kallal MVP, allows you to cleanly shutdown the Access application. Of course you could do it with Application.Quit, but sometimes the Access application fails to shutdown if one ore more objects remain instantiated. Therefore, this is a better approach. Click here to read a commentary by Albert on shutting down Access is this way. Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Const WM_CLOSE = &H10 'If the function succeeds, the return value is nonzero
Public Function ExitDatabase() As Long
ExitDatabase = PostMessage(Application.hWndAccessApp, WM_CLOSE, &H0, &H0)
End Function
|
Tested on...
|
| Home • Company • Services • Employment • Support Centre • Events • Contact Us | Pacific Database © 2008 |