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!

Screen Position of Form in Access

Status
Not open for further replies.

StuGreentree

IS-IT--Management
Dec 31, 2001
8
0
0
US
I am trying to determine the screen position of an Access 2000 form through API calls. I know there are several steps but I do not know the correct sequence, nor do I know the proper syntax to work in Access. Is there anyone who has done this that can provide some insight. Thanks...
 
This should do what you want:

Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As Long, lpRect As RECT) As Long

Type RECT
left As Long
top As Long
right As Long
bottom As Long
End Type


Public Sub GetFormPosition()

Dim r As RECT ' receives window rectangle
Dim retval As Long ' return value

retval = GetWindowRect(Forms!Form1.hwnd, r) ' set r equal to Form1's rectangle
Debug.Print "Width ="; r.right - r.left
Debug.Print "Height ="; r.bottom - r.top

End Sub

HTH,

Ed Metcalfe.
 
Worked like a charm. Thanks again for your assistance....

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top