Images in Report, formerly viable code not working

Johnette

Registered User.
Local time
Today, 17:12
Joined
Aug 4, 2003
Messages
12
Greetings, all

I am developing a Microsoft Access 2000 database (on Windows XP) that will have a report with images. (Two different images on the same page in the end, but that's perhaps a future post.) I'm using an image frame to display images and a text box to concatinate the file path/name. Through a lot of trial and error, message board interaction/review, MS Knowledge base review, etc., I came up with some code that worked well for a previous project that I did a couple of years ago. I thought I could use the same exact code for this new project, but for some reason the report doesn't want to show the jpgs. Actually, the "no picture available" jpg will display, but the record-specific saved jpgs won't. It seems to at least be looking in the right place, as the photos are all in the same folder.

If I remove the error trap in the code, I get a "run-time error 2220" message that says it can't open the jpg file. Just because I'm curious, I copied the "no picture available" jpg (since it will display that) and renamed as the file name it's telling me it can't open. This did not solve the problem, as I continue to get the same message with the same file name.

Sorry for the long-winded post, but I thought I would try to answer your potentially most basic questions up front.

Please consider, my code skills were enough to cobble things together in a workable fashion to this point, rather than creating great new compositions. The code I'm using is below. Thanks a million for your consideration.

Best regards,
- Johnette


Option Compare Database

Private Sub Form_Current()
On Error Resume Next
Me![Photo2].Picture = Me![PhotoName2]
End Sub

Sub PhotoName2_AfterUpdate()
On Error Resume Next
Me![Photo2].OLETypeAllowed = 1
Me![Photo2].SourceDoc = Me![PhotoName2]
Me![Photo2].Action = 0
End Sub


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strNoPicFile As String
strNoPicFile = "P:\070064 - Wash West Historic District\Database\Survey Photos\NoPicFile.jpg"

On Error GoTo Err_Detail_Format

If IsNull(Me!PhotoName2) = False Then
Me![Photo2].Picture = Me![PhotoName2]
End If

Exit_Detail_Format:
Exit Sub

Err_Detail_Format:
Select Case Err.Number
Case 2220
Me![Photo2].Picture = strNoPicFile
End Select

Resume Next

End Sub
 
Holy silly mistakes, Batman! I may have figured out a silly error that has nothing to do with the code... will report back after some additional testing...!! :o
 
Resolved!!

The code DOES work!
Alright, get ready for this one...

In the text box on the report, I had
="\\P:\070064" and so on. Apparently, I don't need the two initial backslashes! I needed them in the previous version, but not here. Maybe it has something to do with our server conversion recently?

Ok, I'm ready for the rotten tomatoes. Let 'em fly!! :D
 

Users who are viewing this thread

Back
Top Bottom