Version issues for image referencing on reports?

P

paul bennett

This is the VB code for two image frames on a report. The frames display an
image of a location based on a site number, which is also the image filename.
This works just fine on my version of Access (2002), but will not work when
the database is opened with Access 2003.
The same form of code is used to pull the images into a form, which works
fine in both versions.

The error is "invalid arguement, call or function"

Any ideas as to what is causing this?
.....................................................................................
Private Sub detail_format(cancel As Integer, formatcount As Integer)

Dim theDbFullPath As String
theDbFullPath = CurrentDb.Name

Dim theDbFile As String
theDbFile = Dir(theDbFullPath)

theDbFolder = Left$(theDbFullPath, Len(theDbFullPath) - Len(theDbFile))

thePhoto = Me.DATASiteNumber.Value

thePhotoPath = theDbFolder & "GazetteerPhotos\" & thePhoto & ".jpg"
theMapPath = theDbFolder & "GazetteerMaps\" & thePhoto & ".jpg"
theblankpath = theDbFolder & "GazetteerPhotos\" & "Blank.jpg"

If Dir(thePhotoPath) = "" Then
Me.ImgPhoto1.Picture = theblankpath

Else
Me.ImgPhoto1.Picture = thePhotoPath
End If

If Dir(theMapPath) = "" Then
Me.ImgPhoto2.Picture = theblankpath

Else
Me.ImgPhoto2.Picture = theMapPath
End If

End Sub
..................................................................................................
 
D

Douglas J. Steele

Put a break in the code (while in the VB Editor, click on the margin to the
left of the code so that there's a large circle in the margin and the line
of code it's beside is highlighted). When Access enters the module, it will
stop at that particular point in the code. Move from line to line using the
F8 key. Do this slowly so that you know which line causes the error.
 

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