Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I hide or minimize access?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Is there anyway to hide or minimize the whole Access Application from code, while it is doing something in the background? <p>John Vogel<br><a href=mailto:johnvogel@homepage.com>johnvogel@homepage.com</a><br><a href= FreeDSL Service</a><br>[To a get FREE DSL Modem WITH FREE DSL Unlimited Internet Connection click the above link :)]
 
Be carefull with this, read it carefully, or you things can get very hairy.<br>
<br>
How to maximize or minimize the main Access Window from code?<br>
<br>
This same function can also be used to completely hide Access window and just show your form on the desktop. Make the form popup and from it's Open Event, call the fSetAccessWindow function with SW_HIDE as the argument.<br>
<br>
Warning: If you're hiding the main Access window, make sure your error handlers are good. Because with the window hidden, if an error is raised, pressing &quot;End&quot; on the Error window will NOT make Access window visible and you will be left with just the form open. A recommended method is to make a call to fSetAccessWindow with SH_SHOWNORMAL from your error handlers.<br>
If, for some reason, the Access window does not show itself, then you can always close the mdb from the Task List, available in Win 95 with Control-Alt-Delete (once) and under NT, by right clicking on the Taskbar and selecting Task Manager, by selecting the mdb and clicking End Task.<br>
<br>
'************ Code Start **********<br>
Global Const SW_HIDE = 0<br>
Global Const SW_SHOWNORMAL = 1<br>
Global Const SW_SHOWMINIMIZED = 2<br>
Global Const SW_SHOWMAXIMIZED = 3<br>
<br>
<br>
Private Declare Function apiShowWindow Lib &quot;user32&quot; _<br>
Alias &quot;ShowWindow&quot; (ByVal hwnd As Long, _<br>
ByVal nCmdShow As Long) As Long<br>
<br>
Function fSetAccessWindow(nCmdShow As Long)<br>
'Usage Examples<br>
'Maximize window:<br>
' ?fSetAccessWindow(SW_SHOWMAXIMIZED)<br>
'Minimize window:<br>
' ?fSetAccessWindow(SW_SHOWMINIMIZED)<br>
'Hide window:<br>
' ?fSetAccessWindow(SW_HIDE)<br>
'Normal window:<br>
' ?fSetAccessWindow(SW_SHOWNORMAL)<br>
'<br>
Dim loX As Long<br>
Dim loForm As Form<br>
On Error Resume Next<br>
Set loForm = Screen.ActiveForm<br>
If Err &lt;&gt; 0 Then 'no Activeform<br>
If nCmdShow = SW_HIDE Then<br>
MsgBox &quot;Cannot hide Access unless &quot; _<br>
& &quot;a form is on screen&quot;<br>
Else<br>
loX = apiShowWindow(hWndAccessApp, nCmdShow)<br>
Err.Clear<br>
End If<br>
Else<br>
If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then<br>
MsgBox &quot;Cannot minimize Access with &quot; _<br>
& (loForm.Caption + &quot; &quot;) _<br>
& &quot;form on screen&quot;<br>
ElseIf nCmdShow = SW_HIDE And loForm.PopUp &lt;&gt; True Then<br>
MsgBox &quot;Cannot hide Access with &quot; _<br>
& (loForm.Caption + &quot; &quot;) _<br>
& &quot;form on screen&quot;<br>
Else<br>
loX = apiShowWindow(hWndAccessApp, nCmdShow)<br>
End If<br>
End If<br>
fSetAccessWindow = (loX &lt;&gt; 0)<br>
End Function<br>
<br>
'************ Code End **********<br>
<br>
Good Luck,<br>
RDH <p>Ricky Hicks<br><a href=mailto: rdhicks@mindspring.com> rdhicks@mindspring.com</a><br><a href= > </a><br>
 
Awesome! Thankyou so much. This works perfectly! You have saved me hours of frustration trying to figure thaty out :)<br>
<br>
God Bless <p>John Vogel<br><a href=mailto:johnvogel@homepage.com>johnvogel@homepage.com</a><br><a href= FreeDSL Service</a><br>[To a get FREE DSL Modem WITH FREE DSL Unlimited Internet Connection click the above link :)]
 
This was a helpful post, but I keep getting the message saying, cannot hide Access Window, unless a form is open on screen...I have a popup form that has the function set to run when it Opens...For some reason, I get that message and it doesn't hide access and it continues to run the other codes...Please help!
 
jvogel,

Make sure your form has Modal set to Yes as well as having Popup set to yes, I think this will solve your problem as it did for me. Thanks
Woody
[sadeyes]
 
I'm having the same problem as Bitech, and I do have my main splash screen/form set to both Modal and Popup. Anyone have any ideas on what we're doing wrong?

-cheese 47 is a magical number. 47 plus 2 equals 49. 47 times 2 equals 94. 49 and 94. 94 and 49. Relationship between 47 and 2: it's magic.
 
Hi,
i get argument not optional error won the onload event.. ne ideas why thi happens?
cheers Mark
 
did ne1 find out why 'cannot hide Access Window, unless a form is open on screen...' comes up?
apart from modal and popup?
 
The best way is by creating user's profile in Windows registry setting and set your application to use it.
I'll explain later. I had a guess
 
when i turn on my pc it has all the taskbar as if you clicked to open my computer, on the left side .my toolbar is all ok on top of page and the and the bottom, but cant get that off the side, any ideals of how to get rid of this. its as if when you click my computer icon and it never closed,thxs so much lilcrick@prodigy.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top