!!!!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
i dont want to hide the report, i want to have everything behind the report hidden i.e. access window.
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. -
'In the declaration section of your module.
-
Declare Function IsZoomed Lib "user32" (ByVal hWnd As Long) As Long
-
-
Function rSetAccessWindow(nCmdShow As Long, Optional myRep As Report)
-
Dim loX As Long
-
Dim intWindowHandle As Long
-
If nCmdShow = SW_SHOWMINIMIZED And myRep.Modal = True Then
-
MsgBox "Cannot minimize Access with " _
-
& (myRep.Caption + " ") _
-
& "report on screen"
-
ElseIf nCmdShow = SW_HIDE And myRep.PopUp <> True Then
-
MsgBox "Cannot hide Access with " _
-
& (myRep.Caption + " ") _
-
& "report on screen"
-
Else
-
loX = apiShowWindow(hWndAccessApp, nCmdShow)
-
End If
-
-
rSetAccessWindow = (loX <> 0)
-
intWindowHandle = myRep.hWnd
-
If Not IsZoomed(intWindowHandle) Then
-
-
DoCmd.Maximize
-
End If
-
End Function
-
Good luck
where do i specifiy the report?
Denburt 1,356
Recognized Expert Top Contributor - Private Sub Report_Open(Cancel As Integer)
-
Call rSetAccessWindow(0, Me)
-
End sub
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!!!!!!!!!!! !
Got it to work, Really have no idea but it works!! Thanks
Denburt 1,356
Recognized Expert Top Contributor
Your module "SetAccessWindo w"
Should look something like this" -
Option Compare Database
-
Option Explicit
-
-
Global Const SW_HIDE = 0
-
Global Const SW_SHOWNORMAL = 1
-
Global Const SW_SHOWMINIMIZED = 2
-
Global Const SW_SHOWMAXIMIZED = 3
-
Declare Function IsZoomed Lib "user32" (ByVal hWnd As Long) As Long
-
Private Declare Function apiShowWindow Lib "user32" _
-
Alias "ShowWindow" (ByVal hWnd As Long, _
-
ByVal nCmdShow As Long) As Long
-
Function fSetAccessWindow(nCmdShow As Long)
-
-
Dim loX As Long
-
Dim loform As Form
-
On Error Resume Next
-
Set loform = Screen.ActiveForm
-
-
If Err <> 0 Then
-
loX = apiShowWindow(hWndAccessApp, nCmdShow)
-
Err.Clear
-
End If
-
-
If nCmdShow = SW_SHOWMINIMIZED 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(hWndAccessApp, nCmdShow)
-
End If
-
fSetAccessWindow = (loX <> 0)
-
End Function
-
Function rSetAccessWindow(nCmdShow As Long, Optional myRep As Report)
-
Dim loX As Long
-
Dim intWindowHandle As Long
-
If nCmdShow = SW_SHOWMINIMIZED And myRep.Modal = True Then
-
MsgBox "Cannot minimize Access with " _
-
& (myRep.Caption + " ") _
-
& "report on screen"
-
ElseIf nCmdShow = SW_HIDE And myRep.PopUp <> True Then
-
MsgBox "Cannot hide Access with " _
-
& (myRep.Caption + " ") _
-
& "report on screen"
-
Else
-
loX = apiShowWindow(hWndAccessApp, nCmdShow)
-
End If
-
-
rSetAccessWindow = (loX <> 0)
-
intWindowHandle = myRep.hWnd
-
If Not IsZoomed(intWindowHandle) Then
-
-
DoCmd.Maximize
-
End If
-
End Function
-
-
!!!SECOND!!! you have to paste this code into every form
-
-
Private Sub Form_Load()
-
Call fSetAccessWindow(0)
-
End Sub
-
-
In each report you need to enter the following:
-
-
Private Sub Report_Open(Cancel As Integer)
-
Call rSetAccessWindow(0, Me)
-
End sub
-
-
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: - Public Declare Function apiShowWindow Lib "user32" _
-
Alias "ShowWindow" (ByVal hWnd As Long, _
-
ByVal nCmdShow As Long) As Long
Denburt 1,356
Recognized Expert Top Contributor
Glad you got it, glad we were able to help.
ADezii 8,834
Recognized Expert Expert
Glad you got it, glad we were able to help.
That is why we are here, agreed?
Sign in to post your reply or Sign up for a free account.
Similar topics |
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?
|
by: Peter K |
last post by:
How do I Hide/Unhide the Main Database Window in VB?
|
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...
|
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...
|
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
| |
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....
|
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
|
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...
|
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!
|
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
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |