
Originally Posted by
orange
Can you post the code you have for the mousemove?
Here's what I've worked out so far - I actually got the control name to come across using this.
The script I'm using is:
Code:
Public Function ImagePopup(ByRef Ctrl As control)
Dim ControlNamestr As String
Dim ControlImagestr As String
If CurrentProject.AllForms("picturetesting").IsLoaded Then
Else
ControlNamestr = Left(Ctrl.Name, Len(Ctrl.Name) - 7)
ControlImagestr = DLookup("ImageSubf", "ControlPictures", "ControlName = '" & ControlNamestr & "'")
DoCmd.OpenForm "picturetesting"
Forms!picturetesting!PictureSubf.SourceObject = ControlImagestr
Forms!picturetesting.Caption = ControlNamestr
End If
The function is checking if my popup form is already open to eliminate the flicker you'd get if it was constantly trying to open the form/subform. It it's not open then it opens it and sets the SourceObject equal to the value it gets in the DLookup. It also uses the control name to set the popup window's caption so that its titled correctly.
I put the function name with the control name in parenthesis directly into the On Mouse Move option box like this =ImagePopup([checktwodisplay]) - I can't take credit for that, I found it online. This is then set in the function as CTRL. In the script CTRL.Name is the name of the control, which I can then manipulate to knock off the suffix and use to look up a value in the table.
I haven't found anything that lets me do this via straight vba, which is what I'd really like. I'd like to be able to just put ImagePopup into the vba without having to enter the control name. My reasoning for that is to eliminate the need to change script should a control name change. I'd only have to change the control name and the script would take it in stride. If I have to leave it this way then so be it, but I'm hoping that someone can point me in a VBA direction.
DD