Image Control on Report - Error 2100 - HELP!

D

develguy

I need to have an external (linked) image on a report. I have
attempted to use the same code I use in the same DB's forms. The code
on the form(s) is called from OnCurrent and works flawlessly.

I am able to see the images on the report but not before I have to
click through the 2100 error. The code works the same from the header
group and the details section "On Format" sub.

Does anyone know how to bypass/ignore this error or apply my code
correctly?

Here's the code I am using along w/ Lebans:
http://www.lebans.com/loadjpeggif.htm

=====================================================
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If Err.Number = 2100 Then
MsgBox "error"
Exit Sub
End If

On Error GoTo Eignore

Dim sPath As String

If IsNull(PicFileName) Or PicFileName = "" Then
If Len(Dir(Me![PicPath])) > 0 Then
sPath = PicPath
fLoadPicture Me.Image1, sPath, True
Else
'MsgBox "missing image"
sPath = txtPath & "NoImageOnFile.jpg"
fLoadPicture Me.Image1, sPath, True
End If
End If

ScrollToHome Me.Image1

Eignore:
If Err.Number = 2100 Then
MsgBox "error"
Resume
End If
End Sub
=========================================================


Thanks!

Bob
 
S

Stephen Lebans

You do realize the code you are using is meant for Runtime only installs of
Access.

Anyhow, you need to remove the line of code that forces the ScrollBar to
return to its Home position of 0,0. THis is obviously not possible on a
report and is meant for when the Image control is on form being used as a
SubForm as in the sample project.

ScrollToHome Me.Image1


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
B

Bob

Your code seems to work better (and faster w/out the progress bar) than
the standard Image code I was using.

Are there issues I should be aware of by not using this in a runtime
version?

Anyway, I removed the line and still got the error (probably b/c of
the "ScrollToHome" code in the mod). So, I went back to the
"Image.Picture = path" and it works fine. I am OK w/ the progress bar
coming up while it formats the report but it was unacceptable (to me)
for the OnCurrent of a form.

Thanks for your help Stephen!
 
S

Stephen Lebans

There is no need for my code in non Runtime only installs unless you are
working with older versions of Access and very large Images. There are no
negative issues to using the code with any version of Access.

The one thing you must do is turn of the Loading Image dialog. If you don't,
and quickly scroll through the records in Form view, or page quickly in
Print Preview, you run the risk of crashing Access. Use the Registry mod at
the Access MVP site:


Additionally, two issues in regards to the Registry modification pointed to
here http://www.mvps.org/access/api/api0038.htm

1) The Registry key MUST be "No" NOT "no" or "NO"


2) On systems with XP or on systems with more than one user account,
you must add/modify the key in both HKEY_CURRENT_USER and
HKEY_LOCAL_MACHINE.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

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