473,785 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hide Access Window

74 New Member
!!!!FIRST!!! The fallowing code gets placed into a module that has to be called "SetAccessWindo w"

Option Compare Database
Option Explicit

Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZE D = 2
Global Const SW_SHOWMAXIMIZE D = 3

Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow " (ByVal hWnd As Long, _
ByVal nCmdShow As Long) As Long

Function fSetAccessWindo w(nCmdShow As Long)

Dim loX As Long
Dim loform As Form
On Error Resume Next
Set loform = Screen.ActiveFo rm

If Err <> 0 Then
loX = apiShowWindow(h WndAccessApp, nCmdShow)
Err.Clear
End If

If nCmdShow = SW_SHOWMINIMIZE D And loform.Modal = True Then
MsgBox "Cannot minimize Access with " _
& (loform.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loform.PopUp <> True Then
MsgBox "Cannot hide Access with " _
& (loform.Caption + " ") _
& "form on screen"
Else
loX = apiShowWindow(h WndAccessApp, nCmdShow)
End If
fSetAccessWindo w = (loX <> 0)
End Function


!!!SECOND!!! you have to paste this code into every form

Private Sub Form_Load()
Call fSetAccessWindo w(0)
End Sub



The above code works great on forms, but i cant get it to function on Reports. Help?
Apr 6 '07
29 15486
Hutch
74 New Member
i dont want to hide the report, i want to have everything behind the report hidden i.e. access window.
Apr 9 '07 #11
Denburt
1,356 Recognized Expert Top Contributor
I could be mistaken but from what I think you want you are trying to hide the MS Access application but still show reports forms etc. correct?

If this is so then you left out a couple of key pieces of info that would help us understand... Your forms are set to popup and Modal correct?

Using the on_load event allows the following to work...

screen.activefo rm

However since a report does not have an onload event you need to specify which report you are using. I also modified it a bit by grabbing the hwnd of the report itself.


Expand|Select|Wrap|Line Numbers
  1. 'In the declaration section of your module.
  2. Declare Function IsZoomed Lib "user32" (ByVal hWnd As Long) As Long
  3.  
  4. Function rSetAccessWindow(nCmdShow As Long, Optional myRep As Report)
  5. Dim loX As Long
  6.  Dim intWindowHandle As Long
  7. If nCmdShow = SW_SHOWMINIMIZED And myRep.Modal = True Then
  8.     MsgBox "Cannot minimize Access with " _
  9.     & (myRep.Caption + " ") _
  10.     & "report on screen"
  11. ElseIf nCmdShow = SW_HIDE And myRep.PopUp <> True Then
  12.     MsgBox "Cannot hide Access with " _
  13.     & (myRep.Caption + " ") _
  14.     & "report on screen"
  15. Else
  16.     loX = apiShowWindow(hWndAccessApp, nCmdShow)
  17. End If
  18.  
  19. rSetAccessWindow = (loX <> 0)
  20.     intWindowHandle = myRep.hWnd
  21.     If Not IsZoomed(intWindowHandle) Then
  22.  
  23. DoCmd.Maximize
  24.     End If
  25. End Function
  26.  
Good luck
Apr 9 '07 #12
Hutch
74 New Member
where do i specifiy the report?
Apr 9 '07 #13
Denburt
1,356 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. Call rSetAccessWindow(0, Me)
  3. End sub
Apr 9 '07 #14
Hutch
74 New Member
loX = apiShowWindow(h WndAccessApp, nCmdShow)

i got an error that tells me the above code is incorrect, that the sub or fuction is not defined help!!!!!!!!!!! !
Apr 9 '07 #15
Hutch
74 New Member
Got it to work, Really have no idea but it works!! Thanks
Apr 9 '07 #16
Denburt
1,356 Recognized Expert Top Contributor
Your module "SetAccessWindo w"

Should look something like this"
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Global Const SW_HIDE = 0
  5. Global Const SW_SHOWNORMAL = 1
  6. Global Const SW_SHOWMINIMIZED = 2
  7. Global Const SW_SHOWMAXIMIZED = 3
  8. Declare Function IsZoomed Lib "user32" (ByVal hWnd As Long) As Long
  9. Private Declare Function apiShowWindow Lib "user32" _
  10. Alias "ShowWindow" (ByVal hWnd As Long, _
  11. ByVal nCmdShow As Long) As Long
  12. Function fSetAccessWindow(nCmdShow As Long)
  13.  
  14. Dim loX As Long
  15. Dim loform As Form
  16. On Error Resume Next
  17. Set loform = Screen.ActiveForm
  18.  
  19. If Err <> 0 Then
  20. loX = apiShowWindow(hWndAccessApp, nCmdShow)
  21. Err.Clear
  22. End If
  23.  
  24. If nCmdShow = SW_SHOWMINIMIZED And loform.Modal = True Then
  25. MsgBox "Cannot minimize Access with " _
  26. & (loform.Caption + " ") _
  27. & "form on screen"
  28. ElseIf nCmdShow = SW_HIDE And loform.PopUp <> True Then
  29. MsgBox "Cannot hide Access with " _
  30. & (loform.Caption + " ") _
  31. & "form on screen"
  32. Else
  33. loX = apiShowWindow(hWndAccessApp, nCmdShow)
  34. End If
  35. fSetAccessWindow = (loX <> 0)
  36. End Function
  37. Function rSetAccessWindow(nCmdShow As Long, Optional myRep As Report)
  38. Dim loX As Long
  39.  Dim intWindowHandle As Long
  40. If nCmdShow = SW_SHOWMINIMIZED And myRep.Modal = True Then
  41.     MsgBox "Cannot minimize Access with " _
  42.     & (myRep.Caption + " ") _
  43.     & "report on screen"
  44. ElseIf nCmdShow = SW_HIDE And myRep.PopUp <> True Then
  45.     MsgBox "Cannot hide Access with " _
  46.     & (myRep.Caption + " ") _
  47.     & "report on screen"
  48. Else
  49.     loX = apiShowWindow(hWndAccessApp, nCmdShow)
  50. End If
  51.  
  52. rSetAccessWindow = (loX <> 0)
  53.     intWindowHandle = myRep.hWnd
  54.     If Not IsZoomed(intWindowHandle) Then
  55.  
  56. DoCmd.Maximize
  57.     End If
  58. End Function
  59.  
  60. !!!SECOND!!! you have to paste this code into every form
  61.  
  62. Private Sub Form_Load()
  63. Call fSetAccessWindow(0)
  64. End Sub
  65.  
  66. In each report you need to enter the following:
  67.  
  68. Private Sub Report_Open(Cancel As Integer)
  69. Call rSetAccessWindow(0, Me)
  70. End sub
  71.  
  72.  
Apr 9 '07 #17
ADezii
8,834 Recognized Expert Expert
loX = apiShowWindow(h WndAccessApp, nCmdShow)

i got an error that tells me the above code is incorrect, that the sub or fuction is not defined help!!!!!!!!!!! !
You are getting this Error because your API is declared Privately as opposed to Publically. Declare it as:
Expand|Select|Wrap|Line Numbers
  1. Public Declare Function apiShowWindow Lib "user32" _
  2. Alias "ShowWindow" (ByVal hWnd As Long, _
  3. ByVal nCmdShow As Long) As Long
Apr 9 '07 #18
Denburt
1,356 Recognized Expert Top Contributor
Glad you got it, glad we were able to help.
Apr 10 '07 #19
ADezii
8,834 Recognized Expert Expert
Glad you got it, glad we were able to help.
That is why we are here, agreed?
Apr 10 '07 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

6
11489
by: adrien | last post by:
Hi, (also posted in netscape.public.mozilla.browser) i use netscape 7 and want to hide the scrollbars of the window when something happens. I tried this: window.scrollbars.visible=false window.scrollbars.visibility="no" .... nothing works Is it also possible only to hide the vertical scrollbar instead of both?
2
18375
by: Peter K | last post by:
How do I Hide/Unhide the Main Database Window in VB?
8
4026
by: MLH | last post by:
My autoexec macro in an Access 2.0 database has 2 lines. The first runs DoMenuItem - Database - Window - Hide. The second lines is Runcode - Initialize(). Initialize is a procedure in a global module that opens a form. When the form opens, the database window is still present and visible. I thought the first line of the macro would run to completion before the second line started and certainly before any lines in Initialize() were...
1
1605
by: mr.mcgrew | last post by:
Out of nowhere a database I had set to hide the DB window at startup began showing the dang window. It doesn't matter how many times I set/unset/reset the property, it has no effect. I've tried setting the property from code, still won't hide. I've checked via code to make sure the property was indeed created and set in the DB properties collection; it was, and the thing still shows. I've even created a brand spanking new mdb file and...
13
14746
by: DS | last post by:
How do you hide the Title Bar for Access the application. I have everything done but I need to hide the title bar. I've seen code to hide Access but that seems like overkill. Can I put hiding the Title Bar in the Load property of the first form that loads, What would the syntax be. Thanks DS
9
2832
by: Mark | last post by:
Hi All, I am trying to use the function found on the MVP site http://www.mvps.org/access/api/api0019.htm to hide the Access window. I must be missing something as I keep getting an error message: "You entered an expression that requires a form to be the active window". I have a popup form set to open when the DB is opened. On the open event of the form, I have the following code: fSetAccessWindow (SW_HIDE) as instructed on the web page....
1
10231
by: lauren quantrell | last post by:
Before getting pistol whipped, I know this is a well-worn topic but I don't see the answer... I know how to hide the Access window, I know how to disable the Access application's close button, but how do you HIDE the Access close button. Also, while I'm at it, what I really want to do is to hide the Access application's minimize, mazimize and close buttons. Thanks, lq
4
4392
by: Blaine | last post by:
Does anyone know how I can hide a form from the TaskManager? I've set the ShowInTaskbar to False, but when using Alt-TAB to switch between applications, it appears as a blank icon. I can set it as a SizableToolWindow, but then I no longer have the minimize button on the caption. Is there a way to mimic a (FormBorder) sizable tool window (so it doesn't appear in the tasklist) and still show the Min, Max and Close control buttons? (Or...
11
7327
by: Nick 'The database Guy' | last post by:
Hi People, How do you go about hiding the database window. The reason for doing this is that sometimes have to manually add data to tables. I have a fully interatctive menu system from which you can show the 'database window', the same button that you have to press to show the database window opens a small modal form which has one button which will return you to the menu system, but I also want it to close the database window!
5
8969
by: xrado | last post by:
when i say window.hide(), window dont hide imidetly i want to hide it for a few seconds, do something and then show it back how can i do this? i have this example: import pygtk,time pygtk.require('2.0') import gtk
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10341
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9954
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8979
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.