Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report with pictures crashes on print

Status
Not open for further replies.

jweisman

Technical User
May 1, 2002
26
0
0
US
I am using Access 97. I have a report that has a picture associated with each record. The pictures are stored in a separate directory and the path is found with the OnFormat event. The picture load fine if I cycle throught the records. However, if I try to print out the report for more than 30 records, the report crashes. I get an error message that states that the picture cannot be found. I checked the directory and the pictures exist and the picture will show up if I scroll through the report one record at a time. I also have noticed that access loads two pictures every time that I go to the next record. It loads the current record and the next record, even though the report only shows the current picture. The following is the code that I am using to link the pictures. Any help would be greatly appreciated.

thanks,

Jeff Weisman

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim MyDB As Database, myLoc As Recordset
Dim myPath, myFile, strSource As String
Dim txtLocation As Integer
Dim txtLocName As String



Set MyDB = CurrentDb()
Set myLoc = MyDB.OpenRecordset("tblFileLocations", dbOpenTable)


txtLocation = [Forms]![frmSearch_Reports]![lstSelectALocation].Value
txtLocName = DLookup("[LocationDesc]", "tblLocationDesc", "[LocationID] = " & txtLocation)

myPath = myLoc!PictureLocation & txtLocName & "\"

myFile = Dir(myPath & Me.PWCTankID.Value & "*.jpg") ' Retrieve the first entry


If myFile = "" Then
Me.imgTank.Visible = False
Else
Me.imgTank.Visible = True
Me.imgTank.Picture = myPath & myFile
End If

myLoc.close

End Sub
 
Sure it's not a memory issue? I would bet you'd need a pretty sturdy machine to do that type of thing with access. And the fact that it crashes as the recordset gets larger seems to point to that.

That said, I've never played with images in Access, so I may be way off base here.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top