Size and location of forms.

  • Thread starter Thread starter ReidarT
  • Start date Start date
R

ReidarT

Is it possible to have a form that I have opened with
form.resize (t,l,x,y) move when I move the main form?
reidarT
 
Check Help for the DoCmd.MoveSize method.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
As far as I am aware, there isn't an event that is fired when (and only
when) a form is moved. However, you could use the Timer event of the second
form to check the position of the first form ...

Private mlngOtherFormTop As Long
Private mlngOtherFormLeft As Long

Private Sub Form_Open(Cancel As Integer)

If CurrentProject.AllForms("Form3").IsLoaded Then
mlngOtherFormTop = Forms("Form3").WindowTop
mlngOtherFormLeft = Forms("Form3").WindowLeft
End If
Me.TimerInterval = 250

End Sub

Private Sub Form_Timer()

Dim lngOtherFormTop As Long
Dim lngOtherFormLeft As Long

If CurrentProject.AllForms("Form3").IsLoaded Then
lngOtherFormTop = Forms("Form3").WindowTop
lngOtherFormLeft = Forms("Form3").WindowLeft
If lngOtherFormTop <> mlngOtherFormTop Or lngOtherFormLeft <>
mlngOtherFormLeft Then
mlngOtherFormTop = lngOtherFormTop
mlngOtherFormLeft = lngOtherFormLeft
Me.Move mlngOtherFormLeft + 1000, mlngOtherFormTop + 1000
End If
End If

End Sub
 
Back
Top