You have to have one filed which should help you define the same record. For
Example CustomerID or which key do you have?
This field should be in both forms. (You could hide it on the first form if
you don't need it) BUT you should have the link. How you will define the
right photo???
stLinkCriteria = <here is the condition for the second form>
stLinkCriteria = "[KeyFieldNameOnTheSecondFrm]=" &
[KeyFieldNameOnTheFirtsName]
Where do you have the photo? on the different form or in subform?
If it is in the subform, you need to select Master and Child field in
subform properties and the form will have the photo in subform without any
additional coding.
If you have Main Form and want to open secod form with target photo (both
forms should have the key field, that you could define the right photo), you
need to create the button ON THE MAIN FORM and OnClick event put the code:
Dim strFormName As String
Dim strLinkCriteria As String
'Open the second form and go to same photo on the Second separate form
strFormName = "frmPhoto"
strLinkCriteria = "[PhotoID]=" & Forms![frmMain]!PhotoID
DoCmd.OpenForm strFormName, , , strLinkCriteria
Regards,
Iryna
Bradley C. Hammerstrom said:
Iryna,
As you suggested, I tried the following with reference to the subform, but
no good.
Dim strFormName As String
Dim strLinkCriteria As String
'Open the Main form and go to same photo on the subform
strFormName = "frmMain"
strLinkCriteria = "Forms!frmMain.frmMainSub1.Form![PhotoID]=" &
Me!PhotoID
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
what are you doing?