PopUp Menu & Hidding Access Window Error

Gman

Registered User.
Local time
Today, 13:35
Joined
Oct 17, 2008
Messages
39
I have a form and when I open it, the access window is hidden.
I also have created popup menu when I click a command button, the menu works fine in the form, but only if you do not hide access window.
I get an error message

Does anyone know how I can do both,

This is the code i use to hide the access window.

Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Dim dwReturn As Long
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Public Function fAccessWindow(Optional Procedure As String, Optional SwitchStatus As Boolean, Optional StatusCheck As Boolean) As Boolean
If Procedure = "Hide" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
End If
If Procedure = "Show" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
If Procedure = "Minimize" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED)
End If
If SwitchStatus = True Then
If IsWindowVisible(hWndAccessApp) = 1 Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
Else
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
End If
If StatusCheck = True Then
If IsWindowVisible(hWndAccessApp) = 0 Then
fAccessWindow = False
End If
If IsWindowVisible(hWndAccessApp) = 1 Then
fAccessWindow = True
End If
End If
End Function

This is the code I use to create the menu,

Function CreateSubMenu() As CommandBar
''Name for popup menu
Const lcon_PuName = "PopUpDemo"
''Create some objects
Dim cb As CommandBar
Dim cbc As CommandBarControl
''Ensure our popup menu does not exist

DeleteCommandBar lcon_PuName
''Add our popup menu to the CommandBars collection
Set cb = CommandBars.Add(Name:=lcon_PuName, Position:=msoBarPopup, MenuBar:=False, Temporary:=False)
'' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'' Add some demo controls
Set cbc = cb.Controls.Add
With cbc
.Caption = "&Envelope Table"
.OnAction = "DummyMessage"
End With
Set cbc = cb.Controls.Add
With cbc
.BeginGroup = True
.Caption = "Equipment Table"
.OnAction = "DummyMessage"
End With

Set cbc = cb.Controls.Add
With cbc
.Caption = "Room Types"
.OnAction = "DummyMessage"
End With
 
Does anyone know how I can do both,
Simple answer is - You can't.

The popup menus exist within the Access application window and do not show up outside of that environment.
 
Thank you,

Thats all I needed to here, I will try a different method
 

Users who are viewing this thread

Back
Top Bottom