How do I prevent other actions until function is done?

  • Thread starter Thread starter Tony Vrolyk
  • Start date Start date
T

Tony Vrolyk

I have an app that is being distributed as an MDE with Access RT. In the app
I am using a function from Stephen Lebans to display linked JPGs. At one
point the users can move through items in a list box and a JPG is displayed
with each change. If the user changes too quickly they can generate a "macro
or function preventing <app> from saving data" error.

I am pretty sure that this happens because the function to display the JPG
is being called again before it is done from the previous call. The error
occurs without triggering the regular error trapping that is in the code and
I don't see a number to trap anyway. Is there a way to stop any other
functions or events from executing until the function is done?

Tony Vrolyk
 
Tony the code in my function should not be able to generate this error.
Try commenting out any and all of your code that surrounds the call to
my function. Try to reproduce the issue when you are are only loading an
image via my code.

Let me know.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
I will take a look. Give me a day or two and I will get back to you.

thanks
Tony
 
Just before sending my last post I though I wouldn't have time this evening
to take a look. But as it turns out I did. Here is what I found.

I am pretty sure I have commented everything out and am still getting the
error. Here is a more detailed description of what I am doing.

On a form I have a list box. On AfterUpdate of the list box, I call your
function, like the following
fLoadPicture Forms!Projects_Thumbnails.imgThumb, Me.lstProjects.Column(4),
False

Me.lstProjects.Column(4) is a hidden column. Projects_Thumbnails is a
non-modal pop-up and has no code at all, only an image control and a label
that is used to show a message when no pic is selected.

The error occurs whenever I click or move within the listbox before the
picture has loaded. Hence my assumption that it is being called again before
finishing.

I modified the fLoadPicture function only slightly. I removed all the dialog
box stuff since the user will have already selected and stored the file
location in a text field. Otherwise I have left your code alone. I did
remove the fSaveImagetoDisk, fSavePicture, fStdPicToImageData and
ScrollToHome functions as I have no need for them.

Of course this is all modified per your instructions for testing - normally
I do not call the fLoadPicture right from the AfterUpdate of the listbox. I
normally do an unrelated command button enable/disable, check that the
Projects_Thumbnails form is loaded, check that Me.lstProjects.Column(4) is
not null, then call a function which verifies that the file exists and
finally calls fLoadPicture. But again I commented this all out and went
straight to the fLoadPicture for testing.

Last detail -- on the PC where I develop this, the pics are being pulled
across the network from a server, and not a very fast server. However, in
99.9% of the time, my customers will be pulling pics from their local PC.
But in the event of a large pic on a slow machine I want to get this
resolved.

I hope this helps you to understand my situation and it wasn't too wordy as
I tend to be. I assume from your post that you know what error I am getting.
If not, I can give you the full text or a screenshot if that would help.

Thanks
Tony
 
Back
Top