Access forum openen op muis positie

Status
Niet open voor verdere reacties.

janusvl

Gebruiker
Lid geworden
11 apr 2009
Berichten
159
Ik wil graag met visual basic een Access Forum openen op de positie waar de muis op dat moment zit. Weet iemand hoe ik dit kan doen?

Ik heb nu:

doCmd.openform "Formname"

Iemand een idee?
 
het is me toch nog gelukt

Code:
Private Type POINTAPI
    X As Long
    Y As Long
End Type

Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long

'***********************
'THESE TWO FUNCTIONS RETURN THE POSITION ON THE SCREEN
'IN PIXELS, OF THE CURSOR

'EXAMPLE USAGE:

'Private Sub Form_MouseMove(Button As Integer, _
     'Shift As Integer, X As Single, Y As Single)

'    Label1.Caption = "X Screen Position = " & GetXCursorPos
'    Label2.Caption = "Y Screen Position =  " & GetYCursorPos
'End Sub
'***********************************

Public Function GetXCursorPos() As Long
   Dim pt As POINTAPI
   GetCursorPos pt
   GetXCursorPos = pt.X
End Function

Public Function GetYCursorPos() As Long
   Dim pt As POINTAPI
   GetCursorPos pt
   GetYCursorPos = pt.Y
End Function


Private Sub UnitPrice_Click()
DoCmd.Close acForm, "LastPP"
If GetXCursorPos < 1900 Then
DoCmd.OpenForm "LastPP"
'MsgBox (Me.ProductID)
If GetYCursorPos < 300 Then
DoCmd.MoveSize GetXCursorPos * 15.1, GetYCursorPos * 8.5, 4000, 200
End If
If GetYCursorPos > 300 And GetYCursorPos < 500 Then
DoCmd.MoveSize GetXCursorPos * 15.1, GetYCursorPos * 11.5, 4000, 200
End If
If GetYCursorPos > 500 Then
DoCmd.MoveSize GetXCursorPos * 15.1, GetYCursorPos * 13, 4000, 200
End If

Else
 MsgBox ("You can not use a second screen here")
End If
End Sub
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan