Detail Format event code

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

The Detail Format event code below pertains
to a report comprised of several pages for a
family directory. Each page has a capacity to
display 10 families, 5 in each of 2 columns.
The detail section contains one image control
and 10 text boxes, into which the public
function FmtDirAddr determines how and
what to populate into the unbound text boxes.
FmtDirAddr would necessarily include some
JET I/O to the back-end DB of its own, as
record information from tables other than the
primary RecordSource are accessed.

There's never been an issue with this code during
the past many years until we've advanced to faster
machines. With the faster machines, there are
sporadic instances where the image control
Me.ImageBox prints with only its boarder
displayed. My suspicion is that the I/O time
on the faster processors is such that the I/O does
not complete before the next record is processed
and the jpg image rendering in the control never
ends before processing proceeds to the next
record.

If my suspicion has some basis in fact, is there a
way to force VBA to wait until the I/O completes?
Otherwise, what other causes might there be?

Thanks,
Bill Stanton

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim ImagePath As String
'================================================================
' The FmtDirAddr sub is common to both the left and right side orientations.
We need only pass
' "our" report name to the sub so that the sub can reference "our" controls.
The various fields
' referenced in the calling sequence are "connected" to this report by means
of "invisible"
' controls you'd see if looking at the report in design mode.
'================================================================

ImagePath = IPImages & "\" & Me.FamilyImageID & ".jpg"
'Path to named image

If Len(Dir(ImagePath)) = 0 Then _
ImagePath = IPImages & "\DefaultPic.jpg" 'Use default if it doesn't
exist

Me.ImageBox.Picture = ImagePath

Call FmtDirAddr("PrtDirRight", [FamilyID], [FamilyName], [FamilyDirFmtID],
[FamilyPOBox], _
[FamilyAddress], [FamilyCityState], [FamilyZip],
[FamilyE-mail], [FamilyPhone])
End Sub
 
I thought it might be due to the jpg progress bar
being enabled, so I set that option to "No" in
the:

HKEY_LOCAL_MACHINE\Software\Microsoft\
Shared Tools\Graphics Filters\Import\JPEG\Options,

there is only one user on the offending machine,
so the key doesn't exist for

HKEY_CURRENT_USER.

Is there an API that I could use where I could
set a timer for the image control loading? Sort
of like I do with some applications using
ShellWait.

Bill
 
Back
Top