Flickering message box when loading image on current

RECrerar

Registered User.
Local time
Today, 12:13
Joined
Aug 7, 2008
Messages
130
Hi,

I have a form which is used to enter user details. The form has a textbox that holds the name of an image and a picture that displays that image. In the oncurrent even of a form I havethe following code that tries to load an image with the name in the textbox and if this is an error (normally due to there being no image name) loads a default image.

The code works but a message box saying something to do with the image path flicks up momentarily. I cant read the exact message as it is too quick but I think it displays an error message that the image can't be found which is then cancelled over-ruled by the on error statement.

Is there a way to stop this message displaying?

I'm thinking check if the file exists before loading rather than relying on the error during loading to tell me the file doesn't exist.

This is the code I am currently using
Code:
'Get the path to the folder containing user images,
'this is a path relative to the location of the database

GetImagePath = CurrentProject.Path & "\EmployeeImages\"
 
DoCmd.SetWarnings False
'Try and load an image for the user

On Error GoTo NoImage
Me![EmployeePic].Picture = GetImagePath & Me![ImageName]
Exit Sub

NoImage:
'If no image exists load default
Me![EmployeePic].Picture = GetImagePath & "blank.jpg"
DoCmd.SetWarnings True

End Sub
 
The message in the message box is

"Importing ............." (where the ...... is the image name)

From this I am deducing that this has nothing to do with the error generated when the image is not found.

Any ideas how I can stop it appearing? My the image is linked not embedded
 
You could wrap the following around the code to se if this helps. I noticed the dialogbox myself when testing it for you.

DoCmd.SetWarnings False/True

David
 
Thanks for the suggestion but I've already set warnings to false for the duration of the code.

As I said it's not exactly critical just doesn't look that smart
 
Can you not do this yourself on your pc?

Start > Run > RegEdit

Navigate to the location and click modify and set to No

If you are distributing this to other machines then let me know and I will send you a patch that will perform this dynamically when the app is first loaded on any machine.

David
 
Here is a module that you can save in your mdb.

When the app opens up you can call the following function to test for the reg key and reset it to No

Code:
Call ResetDialogToNo()
 

Attachments

Hi again,

It appears I can't do it myself by navigating to regedit and changing the setting there as I get a message box telling me permission denied if I do.

I tried your code. I defined RegValue as as string as this wasn't defined and it runs but doesn't do anything, the flickering is still there. Could this be due to my lack of permissions?

Robyn
 
dcrake: RECrerar is refering to
Function SetShowProgressDialogToNo()
which needs RegValue to be dimmed.

i see in the article that HKEY_CURRENT_USER should also be set in Windows 2000 and later and is not set in the code.

thanks to both. i've been looking for something like this for a while now.
 

Users who are viewing this thread

Back
Top Bottom