From: Prakash on
I'm using the foll code to display images from a folder on a form.

Each time I try to scroll to the "next" record a small window flashes
past saying:
"Importing C:\Al-Maha-Membership\Snaps\FILENAME.jpg"

1) Why does this appear even though I've specified: Application.Echo
False

2) If I wait for some time (say 1 sec) between each click to go to the
next record there's no problem. However, if I try to scroll fast the
program hangs after scrolling say 8 to 10 records and Access pops up a
message saying:
Microsoft Office Access has encountered a problemand needs to close.
We are sorry for the inconvenience.

Using Access 2003 over Windows Xp SP3.

Could someone please look at my code and point out as to where I'm
going wrong ?


Private Sub Form_Current()

Application.Echo False
Dim stFileName As String
stFileName = "C:\Al-Maha-Membership\Snaps\" + Me.MembershipNo +
".jpg"

If Dir(stFileName) = "" Then
'MsgBox "file does not exist"
Me.Image_Holder.Picture = ""
Me.Lbl_NoPhotoAvailable.Visible = True
Else
'MsgBox "file does exist"
Me.Image_Holder.Picture = "C:\Al-Maha-Membership\Snaps\" +
Me.MembershipNo + ".jpg"
Me.Lbl_NoPhotoAvailable.Visible = False
End If
Application.Echo True

End Sub



Rgds,
Prakash.
From: Tom van Stiphout on
On Sat, 10 Apr 2010 10:09:15 -0700 (PDT), Prakash
<simran(a)omantel.net.om> wrote:

The image control is an ActiveX control, and they are not directly
under the full control of their host. That's why .Echo does not work.

You are probably overloading it by scrolling too fast, and it crashes.
Nobody is perfect.
One thing that MAY work is if in Form_Current (which fires when you
scroll to the next record) you start a timer (Me.TimerInterval = 1)
and then in the Form_Timer event stop the timer (Me.TimerInterval = 0)
and then load your image.

-Tom.
Microsoft Access MVP




>I'm using the foll code to display images from a folder on a form.
>
>Each time I try to scroll to the "next" record a small window flashes
>past saying:
>"Importing C:\Al-Maha-Membership\Snaps\FILENAME.jpg"
>
>1) Why does this appear even though I've specified: Application.Echo
>False
>
>2) If I wait for some time (say 1 sec) between each click to go to the
>next record there's no problem. However, if I try to scroll fast the
>program hangs after scrolling say 8 to 10 records and Access pops up a
>message saying:
>Microsoft Office Access has encountered a problemand needs to close.
>We are sorry for the inconvenience.
>
>Using Access 2003 over Windows Xp SP3.
>
>Could someone please look at my code and point out as to where I'm
>going wrong ?
>
>
>Private Sub Form_Current()
>
> Application.Echo False
> Dim stFileName As String
> stFileName = "C:\Al-Maha-Membership\Snaps\" + Me.MembershipNo +
>".jpg"
>
> If Dir(stFileName) = "" Then
> 'MsgBox "file does not exist"
> Me.Image_Holder.Picture = ""
> Me.Lbl_NoPhotoAvailable.Visible = True
> Else
> 'MsgBox "file does exist"
> Me.Image_Holder.Picture = "C:\Al-Maha-Membership\Snaps\" +
>Me.MembershipNo + ".jpg"
> Me.Lbl_NoPhotoAvailable.Visible = False
> End If
> Application.Echo True
>
>End Sub
>
>
>
>Rgds,
>Prakash.
From: Salad on
Prakash wrote:
> I'm using the foll code to display images from a folder on a form.
>
> Each time I try to scroll to the "next" record a small window flashes
> past saying:
> "Importing C:\Al-Maha-Membership\Snaps\FILENAME.jpg"
>
> 1) Why does this appear even though I've specified: Application.Echo
> False
>
> 2) If I wait for some time (say 1 sec) between each click to go to the
> next record there's no problem. However, if I try to scroll fast the
> program hangs after scrolling say 8 to 10 records and Access pops up a
> message saying:
> Microsoft Office Access has encountered a problemand needs to close.
> We are sorry for the inconvenience.
>
> Using Access 2003 over Windows Xp SP3.
>
> Could someone please look at my code and point out as to where I'm
> going wrong ?
>
>
> Private Sub Form_Current()
>
> Application.Echo False
> Dim stFileName As String
> stFileName = "C:\Al-Maha-Membership\Snaps\" + Me.MembershipNo +
> ".jpg"
>
> If Dir(stFileName) = "" Then
> 'MsgBox "file does not exist"
> Me.Image_Holder.Picture = ""
> Me.Lbl_NoPhotoAvailable.Visible = True
> Else
> 'MsgBox "file does exist"
> Me.Image_Holder.Picture = "C:\Al-Maha-Membership\Snaps\" +
> Me.MembershipNo + ".jpg"
> Me.Lbl_NoPhotoAvailable.Visible = False
> End If
> Application.Echo True
>
> End Sub
>
>
>
> Rgds,
> Prakash.

Maybe the pics are huge? Or you have a lot if them.

I created a table. Contains 3 fields; ID, PicName, PicImage. Ex:
1
Picture Of Me
C:\Pics\Pic1.jpg

I created an image field on the form and named it PicImage. I set the
PictureType to linked, the Picture link blank.

Then my code in the OnCurrent is
Me.PicImage.Picture = Me.PicLink

I don't get your message. Maybe due to fewer pics, maybe smaller size.
Mine were about 300K. If your pics are 5 megs in size, maybe try
Irfanview (free program) and from the menu try Image/Resize.



From: Prakash on
On Apr 10, 10:36 pm, Salad <sa...(a)oilandvinegar.com> wrote:
> Prakash wrote:
> > I'm using the foll code to display images from a folder on a form.
>
> > Each time I try to scroll to the "next" record a small window flashes
> > past saying:
> > "Importing C:\Al-Maha-Membership\Snaps\FILENAME.jpg"
>
> > 1) Why does this appear even though I've specified:   Application.Echo
> > False
>
> > 2) If I wait for some time (say 1 sec) between each click to go to the
> > next record there's no problem. However, if I try to scroll fast the
> > program hangs after scrolling say 8 to 10 records and Access pops up a
> > message saying:
> > Microsoft Office Access has encountered a problemand needs to close.
> > We are sorry for the inconvenience.
>
> > Using Access 2003 over Windows Xp SP3.
>
> > Could someone please look at my code and point out as to where I'm
> > going wrong ?
>
> > Private Sub Form_Current()
>
> >     Application.Echo False
> >     Dim stFileName As String
> >     stFileName = "C:\Al-Maha-Membership\Snaps\" + Me.MembershipNo +
> > ".jpg"
>
> >     If Dir(stFileName) = "" Then
> >         'MsgBox "file does not exist"
> >         Me.Image_Holder.Picture = ""
> >         Me.Lbl_NoPhotoAvailable.Visible = True
> >     Else
> >         'MsgBox "file does exist"
> >         Me.Image_Holder.Picture = "C:\Al-Maha-Membership\Snaps\" +
> > Me.MembershipNo + ".jpg"
> >         Me.Lbl_NoPhotoAvailable.Visible = False
> >     End If
> >     Application.Echo True
>
> > End Sub
>
> > Rgds,
> > Prakash.
>
> Maybe the pics are huge?  Or you have a lot if them.
>
> I created a table. Contains 3 fields; ID, PicName, PicImage.  Ex:
>         1
>         Picture Of Me
>         C:\Pics\Pic1.jpg
>
> I created an image field on the form and named it PicImage.  I set the
> PictureType to linked, the Picture link blank.
>
> Then my code in the OnCurrent is
>      Me.PicImage.Picture = Me.PicLink
>
> I don't get your message.  Maybe due to fewer pics, maybe smaller size.
>   Mine were about 300K.  If your pics are 5 megs in size, maybe try
> Irfanview (free program) and from the menu try Image/Resize.- Hide quoted text -
>
> - Show quoted text -


Hi Salad ...

I have approx 450 images in the folder. They are jpegs and the average
size of each is approx 20kb. Largest file is 35kb.

Someone else had written this membership application earlier and had
used a bound object frame control with the photos embedded into it.
The table contains approx 500 records and the database size is 1gb.

I wanted to bring down the database size & so wanted to keep a
"linked" image rather than embedding it into the database. And as far
as I remember, this is the preferred and advised approach.

Now when I try to scroll the "bound control" even by holding the mouse
down ... the form hiccups (freezes) every 7 to 8 records and then
continues scrolling for another say 8 records all the way till the end
of the table. But NO CRASHING !! (now, this is with my linked image
control disabled). The moment I enable my linked image control, the
crash comes up. This is very frustrating.

Any ideas ?? If it continues like this I may have to deliver the
package with the embedded image control (ugh) ... the database is
unnecessarily bloated.

Rgds,
Prakash.

From: Prakash on
On Apr 10, 9:47 pm, Tom van Stiphout <tom7744.no.s...(a)cox.net> wrote:
> On Sat, 10 Apr 2010 10:09:15 -0700 (PDT), Prakash
>
> <sim...(a)omantel.net.om> wrote:
>
> The image control is an ActiveX control, and they are not directly
> under the full control of their host. That's why .Echo does not work.
>
> You are probably overloading it by scrolling too fast, and it crashes.
> Nobody is perfect.
> One thing that MAY work is if in Form_Current (which fires when you
> scroll to the next record) you start a timer (Me.TimerInterval = 1)
> and then in the Form_Timer event stop the timer (Me.TimerInterval = 0)
> and then load your image.
>
> -Tom.
> Microsoft Access MVP
>
>
>
> >I'm using the foll code to display images from a folder on a form.
>
> >Each time I try to scroll to the "next" record a small window flashes
> >past saying:
> >"Importing C:\Al-Maha-Membership\Snaps\FILENAME.jpg"
>
> >1) Why does this appear even though I've specified:   Application.Echo
> >False
>
> >2) If I wait for some time (say 1 sec) between each click to go to the
> >next record there's no problem. However, if I try to scroll fast the
> >program hangs after scrolling say 8 to 10 records and Access pops up a
> >message saying:
> >Microsoft Office Access has encountered a problemand needs to close.
> >We are sorry for the inconvenience.
>
> >Using Access 2003 over Windows Xp SP3.
>
> >Could someone please look at my code and point out as to where I'm
> >going wrong ?
>
> >Private Sub Form_Current()
>
> >    Application.Echo False
> >    Dim stFileName As String
> >    stFileName = "C:\Al-Maha-Membership\Snaps\" + Me.MembershipNo +
> >".jpg"
>
> >    If Dir(stFileName) = "" Then
> >        'MsgBox "file does not exist"
> >        Me.Image_Holder.Picture = ""
> >        Me.Lbl_NoPhotoAvailable.Visible = True
> >    Else
> >        'MsgBox "file does exist"
> >        Me.Image_Holder.Picture = "C:\Al-Maha-Membership\Snaps\" +
> >Me.MembershipNo + ".jpg"
> >        Me.Lbl_NoPhotoAvailable.Visible = False
> >    End If
> >    Application.Echo True
>
> >End Sub
>
> >Rgds,
> >Prakash.- Hide quoted text -
>
> - Show quoted text -

Thank you Tom for getting back so fast.

1) So, is there any way to hide/disable that message (loading image
message ...) ??

2) I'm not scrolling it TOO fast (but reasonably fast - Yes). I'm not
continuously pressing the mouse (as with the bound image control)
where it works perfectly albeit a little jerky. But no crashes there.

3) You timerinterval solution is new to me. Could you please show me
exactly how to go about it as I've never used it before? Really
though, I was hoping like in all my other forms (without image
controls), the user can just stand on the "next record" icon with the
mouse button depressed and watch the records zip past in a flash.

If you can think of anything please do let me know. I really
appreciate everyone's efforts here.

I hope you can furnish some more details on the timerinterval event.

Warm Regards,
Prakash.