Move to command

  • Thread starter peljo via AccessMonster.com
  • Start date
P

peljo via AccessMonster.com

On opening the form, i want to give a command with Move To command to move to
the right upper corner. Is there any such command ?
 
A

Arvin Meyer [MVP]

In the Open event, write the following code:

Private Sub Form_Open(Cancel As Integer)
DoCmd.MoveSize 0, 0
End Sub
 
S

Stuart McCall

peljo via AccessMonster.com said:
On opening the form, i want to give a command with Move To command to move
to
the right upper corner. Is there any such command ?

Paste this code into the declarations section of your form's module:

Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindowRect Lib "user32" _
(ByVal hWnd As Long, lpRect As Rect) As Long
Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Then paste this in as your Form_Open event procedure:

Private Sub Form_Open(Cancel As Integer)
Dim r As Rect, w As Long
GetWindowRect GetDesktopWindow(), r
w = (r.Right - r.Left) * 15
DoCmd.MoveSize w - Me.WindowWidth, 0
End Sub


Now your form should open where you want it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top