Question Details form from multiple image controls on main form

josephbupe

Registered User.
Local time
Today, 21:01
Joined
Jan 31, 2008
Messages
247
Hi,

I have different challenges coming up each time I move from one stage to the other with my project. I am adopting a sample posted here for browsing multiple images in MS Access form. Everthing works fine so far, except I cannot open a details form with records specific to the image clicked. Instead the details form opens with the same first record's details in it regardless of which image I click in the main form.

Here is the Functions and the on-click code I have so far:

Code:
Function OpenMyForm(strFormName As String)
    DoCmd.OpenForm strFormName
End Function
Code:
Me("Im_" & Format(Cnt, "00")).OnClick = "=OpenMyForm('F_Details')"
This is the part where I have a problem with:

The image controls in the main form are named as Im_01, Im_02, Im_03 upto Im_18. Therefore I cannot use the usual criteria
Code:
DoCmd.OpenForm strFormName, acViewNormal, , "[ImageID]=" & Me.ImageControlName
to identify the image control since they are named differently. The same naming applies to the Primary key controls (PK_01,PK_02 through PK_18).

How can I add a criteria in the function above so that when an image is clicked the details form opens its particulars?

I will appreciate your help.

Code ? :banghead:Joseph
 
Last edited:
Hi,
Here is the Functions and the on-click code I have so far:

Code:
Function OpenMyForm(strFormName As String)
    DoCmd.OpenForm strFormName
End Function
Code:
Me("Im_" & Format(Cnt, "00")).OnClick = "=OpenMyForm('F_Details')"
Use the form's open argument to transfer image name to the details form, (the code is not tested).

Code:
Function OpenMyForm(strFormName As String, ImageName as String)
    DoCmd.OpenForm strFormName , , , , , , ImageName
End Function
Code:
Me("Im_" & Format(Cnt, "00")).OnClick =  "=OpenMyForm('F_Details', "Im_" & Format(Cnt, "00"))"
 

Users who are viewing this thread

Back
Top Bottom