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 "End" 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 "user32" _<br>
Alias "ShowWindow" (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 <> 0 Then 'no Activeform<br>
If nCmdShow = SW_HIDE Then<br>
MsgBox "Cannot hide Access unless " _<br>
& "a form is on screen"<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 "Cannot minimize Access with " _<br>
& (loForm.Caption + " "

_<br>
& "form on screen"<br>
ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then<br>
MsgBox "Cannot hide Access with " _<br>
& (loForm.Caption + " "

_<br>
& "form on screen"<br>
Else<br>
loX = apiShowWindow(hWndAccessApp, nCmdShow)<br>
End If<br>
End If<br>
fSetAccessWindow = (loX <> 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>