Version issues for image referencing on reports?

  • Thread starter Thread starter paul bennett
  • Start date Start date
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
..................................................................................................
 
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.
 
Back
Top