Access Continuous Form Problem

ChrisBez

New member
Local time
Today, 06:29
Joined
Feb 17, 2020
Messages
17
I have been an Access developer for more than 15 years so I am embarrassed that I can’t fix this problem.



I have a continuous sub form where each record has an ID field as primary key, a text field, and I display a fixed picture in an image box.

There is an on double click event on the image. When I double-click any image it always selects the first record. I msgbox the ID and it is always the first record.

What am I missing?

Any help would be most appreciated and might just save my sanity!!
 
Can you show us the code you have for the Double Click event
 
is the imagebox also in the subform?
 
Can you show us the code you have for the Double Click event

Thanks for respondin, Bob
Here is the code; it is the first line that is the wrong ID
Private Sub FolderImage_DblClick(Cancel As Integer)

Dim FullPath As String
Dim WhereClause As String
Dim FolderName As String
Dim CallingFormName As String

'-----------------------------------------------------------------------------
' The FileFolderID is always the first one
' not the one I click on
'-----------------------------------------------------------------------------
MsgBox Me.FileFolderID

WhereClause = "FileFolderID=" & Me.FileFolderID
FolderName = Nz(DLookup("FolderName", "FileFolderT", WhereClause))
'Stop
WhereClause = "DisplayFileName=" & Wrap(FolderName)
FullPath = Nz(DLookup("FullName", "FileFolderT", WhereClause))
ClearTable "FilefolderT"
StoreFolders FullPath
DoCmd.Close acForm, "FolderF"
CallingFormName = Me.Parent.CallingFormName
OpenMyForm "FolderF", CallingFormName
Forms("FolderF").CurrentSelection.Caption = FolderName

End Sub
 
I tested this using an image control. Since it cannot take focus clicking on an image control does not select the record where you are clicking. I would put a cmd button or something else.
 
Thank you I will set up a button and put my image on that.
I will go and test it now.
It didn't occur to me that the image is not in the record. Duh!!!
 
Thank you Majp, sanity returns, it had to be something daft but I just could not see it.
I set up a square button and added a picture to it.
I also realised that a button can have a double click event. In all these years I have always set up buttons with a single click, but in this case, a double click is more appropriate....unless my user tells me different :O)
Thanks again for your help.
 
This is feedback on my continuous form problem. I offer my solution in the hope that it may help someone in the future.

Having changed my image control to a button the selection worked perfectly thanks to Majp’s help.

Now to pretty it up. The button control would not use my picture which was an icon file (.ico) that I had used in my image control. It then got worse because a button picture does not auto-scale as an image control does.

My solution was to re-instate the image control then put a button of the exact size over the top of the image. The button and its border were then set to transparent. The double-click event was then applied to the invisible button.

The result is that the user sees a picture that when clicked, performs the action. Perfect.

Now on to my next challenge, but I will open another thread for that.

Thanks again to those who responded to my question.
 

Users who are viewing this thread

Back
Top Bottom