linking pictures

  • Thread starter Thread starter Mary
  • Start date Start date
M

Mary

I have seen the many discussions on linking pictures and am running into
trouble. I am using Access 2003.
I have tried using the sample "Pictures2k" but can't figure out where I am
going wrong.

The form is based off a query, which brings together a bunch of information.
1. Placed photos in the same folder as the database.
2. Created a text field in our records table, named per 2k instructions
3. Added the name of one of the photographs to the field (example: name.jpg)
4. Added the field to the query from which the form is based
5. Created a picture frame, renamed it
6. For the form, I created the OnCurrent and OnActivate events by copying
and pasting.

I have been rooting around for about a day and a half trying to find what I
have missed. But I can't seem to figure out where I went wrong. I don't have
any errors, but the photo never shows.

Thanks ahead of time for your help!
 
I have seen the many discussions on linking pictures and am running into
trouble. I am using Access 2003.
I have tried using the sample "Pictures2k" but can't figure out where I am
going wrong.

The form is based off a query, which brings together a bunch of information.
1. Placed photos in the same folder as the database.
2. Created a text field in our records table, named per 2k instructions
3. Added the name of one of the photographs to the field (example: name.jpg)
4. Added the field to the query from which the form is based
5. Created a picture frame, renamed it
6. For the form, I created the OnCurrent and OnActivate events by copying
and pasting.

I have been rooting around for about a day and a half trying to find what I
have missed. But I can't seem to figure out where I went wrong. I don't have
any errors, but the photo never shows.

Thanks ahead of time for your help!

Please post your code. No way we can possibly debug it based on what you
posted!

Examples of the filename, foldre name, and form controls relevant to the
problem would be helpful.
 
Thanks for responding, I should have known to add code, but in this case I am
kind of guessing what code to give you... so here is my best shot...:

Image frame on the form was renamed ImgStock
Text box on form has control source txtPhotoGraph and name txtPhotoGraph

CODE FOR THE QUERY (deleted many of the fields, because it was 3 pages in
word):

SELECT Trim([LastName] & ", " & [Title] & " " & [FirstName]) AS [Index
Name], tblPermanentRecordInformation.txtPhotoGraph,
tblPermanentRecordInformation.LastName,
tblPermanentRecordInformation.FirstName,
tblPermanentRecordInformation.BirthDate,
tblPermanentRecordInformation.BirthCity,
tblPermanentRecordInformation.BirthState,
tblPermanentRecordInformation.RelativeAddress,
tblPermanentRecordInformation.HigherEducation,
tblPermanentRecordInformation.EntranceDate,
FROM tblPermanentRecordInformation INNER JOIN qryNameLookupDNDPermRecord ON
tblPermanentRecordInformation.[ID Number] = qryNameLookupDNDPermRecord.[ID
Number]
WHERE (((Trim([LastName] & ", " & [Title] & " " &
[FirstName]))=[Forms]![frmPermanentRecordInformation]![frmFindPermanentRecord].[Form]![cboName]));


CODE FOR THE FORM (the field name is txtPhotoGraph instead of StockGraph):

Option Compare Database

Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click

DoCmd.Close

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click

End Sub

Private Sub Form_Activate()
'find the path of the current database
'which is where the jpegs are stored
Set db = CurrentDb
FileName = db.Name
pathname = Mid(FileName, 1, Len(FileName) - Len(Dir(FileName)))
End Sub

Private Sub Form_Current()
On Error GoTo Err_cmdClose_Click

'set the picture path
Me.ImgStock.Picture = pathname & Me.txtPhotoGraph

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
If Err.Number = 2220 Then 'can't find the file
Resume Next
Else
MsgBox Err.Description
Resume Exit_cmdClose_Click
End If
End Sub


Private Sub txtPhotoGraph_AfterUpdate()
On Error Resume Next
Me![ImgStock].Picture = Me![txtPhotoGraph]
End Sub



If that's not enough, please let me know what else you will need. I really
appreciate your help.
 
Thanks for responding, I should have known to add code, but in this case I am
kind of guessing what code to give you... so here is my best shot...:

Try moving your Form's Activate code (which fires *before* the textbox
contains the filename) to the form's Current event. If that doesn't work post
back and I'll have a more detailed look.
 
Back
Top