Reference the db Window

aziz rasul

Active member
Local time
Today, 11:03
Joined
Jun 26, 2000
Messages
1,935
If I have a form open, at a reduced size and I can see the db window in the background also at a reduced size. How do I reference the db window, in order to maximise it whilst at the same time maintaining the reduced size of the opened form?
 
Aziz,

I use the following code to minimise the db Window. I have never used it for maximise but it should work.

'************ Code Start **********
Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3


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

Function fSetAccessWindow(nCmdShow As Long)
'Usage Examples
'Maximize window:
' ?fSetAccessWindow(SW_SHOWMAXIMIZED)
'Minimize window:
' ?fSetAccessWindow(SW_SHOWMINIMIZED)
'Hide window:
' ?fSetAccessWindow(SW_HIDE)
'Normal window:
' ?fSetAccessWindow(SW_SHOWNORMAL)
'
Dim loX As Long
Dim loForm As Form
On Error Resume Next
Set loForm = Screen.ActiveForm
If Err <> 0 Then 'no Activeform
If nCmdShow = SW_HIDE Then
MsgBox "Cannot hide Access unless " _
& "a form is on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If
Else
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
End If
fSetAccessWindow = (loX <> 0)
End Function

'************ Code End **********


You could then place the following code in the on open event of the form.

fSetAccessWindow (SW_SHOWMAXIMIZED)

HTH,
Steve
 
Steve, do I need to modify your code in order to maximise the db window. I have copied your code as is in a new module and placed fSetAccessWindow (SW_SHOWMAXIMIZED) in the open event of my form, as you suggested.

At the moment, the db window remains the same size as before.
 
Yes. This only maximises the application not the db window.
 

Users who are viewing this thread

Back
Top Bottom