Forum Discussion
MS Access force a popup on top of other windows?? Is this possible?
If you define the form as modal=yes and popup=yes, then it will be on top of Access until closed. It will also be on top of other applications when opened, but not modal, i.e. selecting other windows will send the popup into background, together with Access.
Option Compare Database
Option Explicit
Public Declare Function SetForegroundWindow _
Lib "user32" _
(ByVal hwnd As Long) _
As Long
Public Function ActivateAccessApp() As Boolean
'Brings the DB to the front of all open windows
Dim appTarget As Access.Application
Set appTarget = GetObject(CurrentDb.Name)
ActivateAccessApp = _
Not (SetForegroundWindow(appTarget.hWndAccessApp) = 0)
Set appTarget = Nothing
End Function
- DML1976Feb 12, 2020Copper Contributor
perrycheng Is this still possible? The code I copied down doesn't seem to do anything.
Option Compare Database
Option Explicit
Public Declare Function SetForegroundWindow _
Lib "user32" _
(ByVal hwnd As Long) _
As LongPublic Function ActivateAccessApp() As Boolean
'Brings the DB to the front of all open windows
Dim appTarget As Access.ApplicationSet appTarget = GetObject(CurrentDb.Name)
ActivateAccessApp = Not (SetForegroundWindow(appTarget.hWndAccessApp) = 0)
Set appTarget = NothingEnd Function