tinmanjo Posted March 18, 2010 Posted March 18, 2010 (edited) 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() Form_frmMain.List0.Requery 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 ? Edited March 18, 2010 by tinmanjo
LosOjos Posted March 18, 2010 Posted March 18, 2010 (edited) 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: http://bytes.com/topic/access/answers/209429-open-form-position-mouse Edited March 18, 2010 by LosOjos
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now