Question : Hourglass not working when used in Image Onclick event in Access 2007

I'm using Access 2007. I don't know if the problem exists in other versions or not.  When initiating the Hourglass command on a command button, the cursor changes to an hourglass like it is supposed to. When initiating the same code on the OnClick event of an image, the cursor does not change to an hourglass.  As an example, paste the following lines of code behind the Onclick command of a command button, and paste the code behind the onclick event of the image and then compare the results.  Anybody have a solution to this?

Dim dt As Date
DoCmd.Hourglass True
dt = DateAdd("s", 6, Now())
Do Until dt < Now
    DoEvents
Loop
DoCmd.Hourglass False
MsgBox "Finished"

Answer : Hourglass not working when used in Image Onclick event in Access 2007

I just tried in Access 2003 and observed the same thing. It's not a problem with screen refresh (this would have been handled by DoEvents anyway) because setting Me.Caption to something at the top of the handler is immediately visible.

On the other hand, when stepping through the code, the hourglass works, but the VB Editor is active at that time. I can only guess that images have a different mouse handling scheme than regular controls: the same happens for both image controls and unbound object frames.

Use conagraman's suggestion or place the image directly in the button (if you want that sort of look). I did not find a way to make the hourglass appear, even by changing the focus and other similar tricks, but I haven't tried WinAPI calls — I'm sure it's possible if you really need it.

(°v°)
Random Solutions  
 
programming4us programming4us