Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Click Event of Image not working correctly.

Status
Not open for further replies.

jjjax64

IS-IT--Management
Apr 27, 2010
39
US
We have an Access 2007 SP2 form that is based on recordset and has an image associated with each record but when use on click event to select that image, it seems to only using data from first record on form not the selected one yet when do exact same code on button, it works fine. This use to work and only thing we can see is that it worked on computer without SP2 of office 2007. Has anyone else seen this issue? Thanks, Joe

Dim stDocName As String
Dim stLinkCriteria As String

Forms!frmMainMenu!txtImagePath = Me.AdImage

stDocName = "frmEnlargeImage"
DoCmd.OpenForm stDocName, , , stLinkCriteria
 
The click event for which object? Provide full code.
 
I just did a quick simple test and here is the code below. This test is just continous form with a simple table as datasource. Just have it displaying current record id field when clicking on button or image Same code in bother but button works fine and displays the correct id for record clicked on but image displays first record id. Thanks for checking it out.

Private Sub Command3_Click()
MsgBox Me.ID
End Sub

Private Sub Image2_Click()
MsgBox Me.ID
End Sub
 
Found a workaround:

Just did below excerpt and seems to be good. Thanks.

As a work around, I placed a command button over the image control, sizing it exactly the same as the image control, and setting the command button's Transparent property to Yes. This make the command button invisible to the user, but will allow things to work as you
want. Place the code in this command button's Click event.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top