+ Post New Thread
Results 1 to 2 of 2
Office Software Thread, Moving an access 2007 form using win api in Technical; I have a sub form which I want to place in a precise place on the desktop using the mouse ...
  1. #1
    tinmanjo's Avatar
    Join Date
    Mar 2010
    Thank Post
    Thanked 0 Times in 0 Posts
    Rep Power

    Moving an access 2007 form using win api

    I have a sub form which I want to place in a precise place on the desktop using the mouse coordinates but the form ends up in the wrong place, basically i want to place the subform near the mouse when i double click on a list item.

    here is the subform code, the problem is it ends up loading in the wrong place, i think it may be that access stores the mouse position differently

    Private Declare Function GetCursorPos Lib "user32" (lpPoint As _
       POINTAPI) As Long
    Private Type POINTAPI
            x As Long
            y As Long
    End Type
    Dim a As POINTAPI
    Dim b As Long
    Dim c As Long
    Private Sub Form_Close()
    End Sub
    Private Sub Form_Load()
    ret = GetCursorPos(a)
    With Me
    .Move a.x, a.y
    End With
    End Sub
    /edit: hmm i think i know what i might be, the coords need to be converted to twips/pix instead of pixels ?
    Last edited by tinmanjo; 18th March 2010 at 05:15 PM.

  2. #2

    LosOjos's Avatar
    Join Date
    Dec 2009
    West Midlands
    Thank Post
    Thanked 1,294 Times in 884 Posts
    Rep Power
    Is the form modal? Because the units are relative to the Access window rather than absolute values for modal forms...

    Try the method at this site to convert pixels to twips:
    Last edited by LosOjos; 18th March 2010 at 05:28 PM.

+ Post New Thread

Similar Threads

  1. Replies: 0
    Last Post: 15th October 2009, 03:50 PM
  2. MOSS 2007 Form based Authentication
    By wesleyw in forum Windows
    Replies: 0
    Last Post: 27th November 2008, 01:11 PM
  3. moving form access to sql server
    By RabbieBurns in forum Office Software
    Replies: 3
    Last Post: 27th August 2008, 04:20 PM
  4. Migrating form RM CC3 to vanilla win 2K3 & XP?
    By nicholab in forum Network and Classroom Management
    Replies: 9
    Last Post: 22nd February 2007, 12:38 PM
  5. Moving Exchange form one server to another
    By tosca925 in forum Windows
    Replies: 10
    Last Post: 22nd November 2006, 02:49 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts