code failure

A

angie

i have entered the following code in the on open event of my report where
"PHOTO"=image in detail section and "ImageText"= jpeg name of the image.

Option Compare Database
Option Explicit
Dim filename As String, pathname As String
Dim db As Database


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.PHOTO.Picture = pathname & "\" & Me.ImageText
End Sub


Private Sub Report_Open(Cancel As Integer)
'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

i have placed the same code in on current event of a form and it works fine.
what is the problem with the report?
i would also like to avoid putting the code in the on open event because i
want to assign a macro there, could i put the code in the on activate event?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top