I don't want the resizing as I don't want to incur all the extra code.
However, if they have the resolution set above this (1024x768) the forms
only take up 800x600 in the top left hand corner. I don't mind this (and do
not want to resize them), but the Access window is maximized to 1024x768
which looks a little ordinary. Is there any way to resize the Access window
itself?
Cheers Adam
www.ssw.com.au
--------------------------------------------------------
Check out these HOT ACCESS UTILITIES....
* SSW Data PRO! (97 and 2000) www.ssw.com.au/ssw/DataPRO - Version Control
for your data.mdb
* SSW Data PRO! Renovator (97 and 2000)
ww.ssw.com.au/ssw/DataPRORenovator - Compare the differences between two
data.mdb's
* SSW Upsize PRO! (97 and 2000)
http://www.ssw.com.au/SSW/Download/default.asp - Don't UPSIZE to SQL Server
without it
--------------------------------------------------------
Try the Windows API MoveWindow function
This will resize and move the Access parent window to where you want.
Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long, ByVal x As
Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal
bRepaint As Long) As Long
Function GetAccessHwnd() As Integer
' Comments : Returns the handle to the Access window
' Parameters: none
' Returns : integer window handle
'
Dim intHWnd As Integer
Dim strClassName As String
Dim intCounter As Integer
intHWnd = GetActiveWindow()
Do
strClassName = Space$(255)
intCounter = GetClassName(intHWnd, strClassName, Len(strClassName))
strClassName = Left$(strClassName, intCounter)
' OMain is the name of the Access window
If strClassName = "OMain" Then
Exit Do
Else
intHWnd = GetParent(intHWnd)
If intHWnd = 0 Then
Exit Do
End If
End If
Loop
GetAccessHwnd = intHWnd
End Function
Then make a call to the API function from VBA:
?MoveWindow(GetAccessHwnd, 100, 50, 800, 600, -1)
The parameters are:
1. The Access Parent window handle
2. Left
3. Top
4 Width
5 Height
6 Repaint
You'll probably want to fiddle around with the parameters.
HTH
Terry
"Adam Cogan" <adam...@ssw.com.au> wrote in message
news:ucx$20NW$GA....@cppssbbsa02.microsoft.com...
Put this Declaration in the Forms General Declaration area.
Private Declare Function MoveWindow Lib "user32" _
(ByVal hWnd As Long, ByVal x As _
Long, ByVal Y As Long, ByVal nWidth As Long, _
ByVal nHeight As Long, ByVal _
bRepaint As Long) As Long
' Here's the code to MoveSize the
' Access Main window behind a Command button
Private Sub CmdSizeWin_Click()
lngret = MoveWindow(Application.hWndAccessApp, 10, 10, 800, 600, -1)
End Sub
HTH
--
Stephen Lebans
maca...@nbnet.nb.ca
http://www.lebans.com
Free Access Code, Tips and Tricks
Terry Chapman wrote...
> Hi Adam,
SNIP
Yes. I have a freeware database available for download from my site
that has examples of resizing the Access window, the form window, and
more. It's called "Window Manipulation Examples", and you can download
it here:
Thanks,
--
Peter De Baets
http://www.thepaintedid.com - The Painted iD
http://www.peterssoftware.com - Peter's Software - MS Access Tools
Sent via Deja.com http://www.deja.com/
Before you buy.