Okay already come to my next hurdle: nevermind.. think i have figured it out.. and if not i probably should post in a new thread anyway.
Okay already come to my next hurdle: nevermind.. think i have figured it out.. and if not i probably should post in a new thread anyway.
What do you mean by 'take me to their record'? Hyperlinks open files or web pages, not a record in a table. If you want to open another form to display the image record, that is like:
DoCmd.OpenForm "formname", , , "ImageLocation='" & Me.Imagecontrolname.Picture & "'"
If you want to move to the record on the form frmQuery11, that is another matter. Options:
1. filter the form
2. use recordsetclone to find the bookmark, example from my project
Private Sub cbxCommunities_AfterUpdate()
'Find the record that matches the control.
Me.RecordsetClone.FindFirst "Community = '" & Me.cbxCommunities & "'"
If Not Me.RecordsetClone.EOF Then Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
Real trick is figuring out what event to use. Maybe the Image control Click or DblClick.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks for your ideas June7, very illuminating as usual. I didn't get to work on it or test much but my idea was to just add a line for a new variable (txtLinkToID1, txtLinkToID2, etc) to the While/Wend loop you helped me create to temp hold the ID numbers of each of the "related" outfits that DAO.recordset select statement is locating:
SQL = "SELECT tblOutfits.[ID], tblOutfits.[Relationship], tblImage.[txtImageName] FROM tblImage INNER JOIN tblOutfits ON tblImage.ID = tblOutfits.Image WHERE ((tblOutfits.[Relationship])=" & Me.[relationship] & ");"
Set RS = CurrentDb.OpenRecordset(SQL)
i = 1
While Not RS.EOF
If RS("ID") <> Me.ID Then
Me("Image" & i).Picture = RS("txtImageName")
Me("Image" & i).Visible = True
Me("txtLinkToID" & i) = RS("ID")
i = i + 1
End If
RS.MoveNext
Wend
RS.Close
Set RS = Nothing
And then use them for the event procedure subs for each of the images (image1,image2, etc) activated on click:
If (txtLinkToID1 & vbNullString) = vbNullString Then Exit Sub
Dim RS As DAO.Recordset
Set RS = Me.RecordsetClone
RS.FindFirst "[ID]=" & txtLinkToID1
If RS.NoMatch Then
MsgBox "Sorry.", _
vbOKOnly + vbInformation
Else
Me.Recordset.Bookmark = RS.Bookmark
End If
I created some "non-visible" texts box (txtLinkToID1, txtLinkToID2, etc) on my form layout to receive the new variables and then use them to hold the value until needed with an event procedure activated by Click on the image:
I dont think creating dummy text boxes to store the txtLinkToID(i) variables is the best method but I dont know how else to do it. Any more efficient coding is welcome!
(my coding knowledge is severely lacking)
Code should be able to pull string back from the Picture property but the textboxes with ID should work just as well.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Muchas gracias.