Delay navigation until image loads in vba

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I have an Access 2003 database where each record of the database is displayed, added to, and edited on a form. One of the controls on the form is an image box that is loaded from a directory containing all the images for the database. One way of navigating thru the records is by clicking on four navigation command buttons on the form.

My problem is that some of the image files are so large that the loading takes a longer time than the operator can navigate to the next record. If the operator keeps tapping the navigation controls looking for a particular record, the image loading can't keep up, and this will eventually cause a run time error. Is there a way to make vba wait for the image to complete loading before leaving the loading subroutine and advancing to the subroutine executing the navigation command? I know a delay routine could be inserted but it isn't necessary for most of the images and I hate to slow the whole program down for just a few images.

I don't know if it's helpful but the following loading takes place in subForm_Current.

If IsNull(txtPhotoID) Then
' No image for this record.
cmdPixDelete.Visible = False
txtPhotoID.Visible = False
lblPhotoID.Visible = False
cmdPixLoad.Visible = True
Else
cmdPixLoad.Visible = False
On Error GoTo PixLoadError
imgPhoto.Picture = IMAGE_PATH & txtPhotoID & IMAGE_FILE_EXTENSION
Call AdjustTxtPhotoIDBoxWidth
txtPhotoID.Visible = True
cmdPixDelete.Visible = True
imgPhoto.Visible = True
End If

.



Relevant Pages

  • Re: Refreshing controls when movenext in record
    ... How do I change the settings of the form not to show up when database is ... >> I have a form created in access and I have added a few controls which are to ... the the navigation given when access table is opened up for move to next ... The first question - use the Current event ...
    (microsoft.public.access.formscoding)
  • RE: Refreshing controls when movenext in record
    ... How do I change the settings of the form not to show up when database is ... "Madhuri" wrote: ... > I have a form created in access and I have added a few controls which are to ... the the navigation given when access table is opened up for move to next ...
    (microsoft.public.access.formscoding)
  • Re: Generating one table with a terabyte of data
    ... I didn't know we could split a database file group over multiple HDs. ... > Run perfmon counters to a log and analyze them after a bulk load. ... Another thing is to split the updates across file sets. ... >> loading of daily data in the fastest time. ...
    (microsoft.public.sqlserver.dts)
  • Re: HELP!! - All my code disappeared!!!
    ... I have a database on which I have been working for a while. ... I have a form (called frmFrame) which simply contains a navigation ... subforms themselves have subforms, ...
    (comp.databases.ms-access)
  • Re: "top" consumes 25% cpu time
    ... Actually it's a webserver - what has gotten slow is the page loading ... On my local test machine with local database (a ...
    (alt.os.linux.suse)