PDA

View Full Version : How to trigger a popup form in Access table View



alexdich
04-25-2010, 06:29 PM
Hello guys, I'm new to VBA. I was wondering if it is possible to invoke a popup form inside a table in View mode and make it appear on x,y coordinate. Thanks in advanced.

Regards,

Alexis D.

OBP
04-26-2010, 04:02 AM
Tables do not have "Event Procedures" to trigger the VBA code.
Why would you want to look at tables in View mode, forms are for viewing the data?

CreganTur
04-26-2010, 05:53 AM
You might be able to do something like this on a form that's using Data Sheet View... google's not providing any good info on this subject yet- it'll take some searching to find.

c_smithwick
04-26-2010, 11:02 AM
Design your form to display in datasheet mode and then put the following in a public standard module. Set your forms OnMouseMove event to the following "=mousepos()". This will display your popup form. You will need to determine the X and Y coordinates of whatever box you want to define to trigger the popup.


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 blnPopup As Boolean

Public Function mousepos()

Dim var As Variant
Dim ret As Long

ret = GetCursorPos(a)
' Define a rectangular area and display a popup if mouse is within this box

If a.x > 400 And a.x < 600 Then
If a.y > 200 And a.y < 300 Then ' mouse is within confines of box - display popup
If Not blnPopup Then
DoCmd.openForm "frmPopup"
'Set a boolean to indicate popup is displayed to prevent action when moving the mouse again until popup is closed
blnPopup = True
End If
End If
End If

End Function

Public Function closePopup()

' run this function in the onClose Event of your popup form to reset the boolean flag
blnPopup = False
End Function