473,770 Members | 1,645 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 #1
29 15482
ADezii
8,834 Recognized Expert Expert
!!!!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?
The 'Handle' to a Report Window is defined by its hWnd Property. Are you properly passing this value to the API Function, something similar to:
Expand|Select|Wrap|Line Numbers
  1. loX = apiShowWindow(Reports!rptYourReport.hWnd, nCmdShow)
Apr 7 '07 #2
Hutch
74 New Member
loX = apiShowWindow(R eports!rptYourR eport.hWnd, nCmdShow)

I tried pasting the above in the code were i saw it begin with "lox=" but no success. do i need to write this code for every report i have a place the report name in "rptYourReport" ?

I use this code just the way you see it at the top of this page and it works on all my forms just fine, could it have something to do with the "form" verbage used through out the code? i tried changing this to "report" and still had no luck.
Apr 7 '07 #3
ADezii
8,834 Recognized Expert Expert
loX = apiShowWindow(R eports!rptYourR eport.hWnd, nCmdShow)

I tried pasting the above in the code were i saw it begin with "lox=" but no success. do i need to write this code for every report i have a place the report name in "rptYourReport" ?

I use this code just the way you see it at the top of this page and it works on all my forms just fine, could it have something to do with the "form" verbage used through out the code? i tried changing this to "report" and still had no luck.
__1. The Reports must be Open for the code to work.
__2. You need only pass the 'Handle' of the open Report to the API Function:
Expand|Select|Wrap|Line Numbers
  1. Dim intHandle As Long
  2. intHandle = Reports!rptYourReport.hWnd OR Me.hWnd (in proper context)
  3. loX = apiShowWindow(intHandle, nCmdShow)
__3. As far as apiShowWindow() is concerned, it only needs a Long Integer representing the Handle of the Report and a Parameter indicating what it should do with this Window (Report)
Apr 7 '07 #4
ADezii
8,834 Recognized Expert Expert
loX = apiShowWindow(R eports!rptYourR eport.hWnd, nCmdShow)

I tried pasting the above in the code were i saw it begin with "lox=" but no success. do i need to write this code for every report i have a place the report name in "rptYourReport" ?

I use this code just the way you see it at the top of this page and it works on all my forms just fine, could it have something to do with the "form" verbage used through out the code? i tried changing this to "report" and still had no luck.
I have made the assumption that you have modified the following lines of code to reference a Report and not a Form, have you?

Function fSetAccessWindo w(nCmdShow As Long)
Set loform = Screen.ActiveFo rm

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
End If
End Function
Apr 7 '07 #5
Hutch
74 New Member
Yes i changed all the verbage of "Form" to "Report" Example

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

is now

Dim loX As Long
Dim loform As Report
On Error Resume Next
Set loform = Screen.ActiveRe port

but i cant seem to find the following code to change that you call out in your last reply

"Dim intHandle As Long
intHandle = Reports!rptYour Report.hWnd OR Me.hWnd (in proper context)
loX = apiShowWindow(i ntHandle, nCmdShow)"
Apr 9 '07 #6
Hutch
74 New Member
After all these changes the code does not work on the reports but still works on the forms. argh!


Thank you so much for all your help.
Apr 9 '07 #7
Denburt
1,356 Recognized Expert Top Contributor
Interesting approach, I was also able to utilize it for my forms but not the reports, it must have something to do with the fact that reports are handled differently...
Apr 9 '07 #8
Hutch
74 New Member
I still need help figuring this code out
Apr 9 '07 #9
ADezii
8,834 Recognized Expert Expert
Interesting approach, I was also able to utilize it for my forms but not the reports, it must have something to do with the fact that reports are handled differently...
Denburt, just for your own information:
I had absolutely no problem opening a Report called Report1, then executing the following code in the Click() Event of a Command Button. The end result was that that Report1 was now hidden. I did call the API Function directly:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdTestButton_Click()
  2.   Dim loX As Long
  3.   loX = apiShowWindow(Reports!Report1.hWnd, 0)
  4. End Sub
Apr 9 '07 #10

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

Similar topics

6
11488
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
18373
by: Peter K | last post by:
How do I Hide/Unhide the Main Database Window in VB?
8
4024
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
14744
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
10229
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
4391
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
8968
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
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10232
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...
0
9873
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
8891
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
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
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
3974
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
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2822
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.