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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find screen location coordinates of one popup form from another popup form 3

Status
Not open for further replies.

lamarw

MIS
Dec 18, 2002
223
US
Hi everyone,
I'm trying to find the screen location coordinates of one popup form from another popup form. I will be using these coordinates to ensure the two popup forms stay together and move together. I know there's no event to fire this action, with the exception of the timer event, but I just don't know how to get the coordinates. I think it will require an API but I'm not sure. Please help. Then, after I retrieve the coordinates, I will try to figure out how to convert them (if necessary) and use them.​

Thanks,

Lamar
 
The following code worked for me to have one form move with another form.
Code:
Option Compare Database
Option Explicit
Private ChaseForm As Access.Form
Private myOffSetVertical As Long
Private myOffSetHorizontal As Long


Private Sub Form_Open(Cancel As Integer)
  Set ChaseForm = Forms!PopUp1
  myOffSetVertical = ChaseForm.WindowTop
  myOffSetHorizontal = ChaseForm.WindowLeft
End Sub

Private Sub Form_Timer()
  Dim moveHorizontal As Long
  Dim moveVertical As Long
  moveHorizontal = ChaseForm.WindowLeft + myOffSetHorizontal
  moveVertical = ChaseForm.WindowTop + myOffSetVertical
  Me.Move moveHorizontal, moveVertical
End Sub
 
How's it going MajP!
Thank you for the snippet. It's exactly what I was looking for. It never occurred to me to declare a form variable and set it equal to the other form. Brilliant!

Lamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top