hourglass delay (1 Viewer)

wiklendt

i recommend chocolate
Local time
Today, 12:05
Joined
Mar 10, 2008
Messages
1,746
hi,

i have a form with a hyperlink to a website and a command button to activate. this works fine, but takes a while and i'd like to let my end user know that the cogs are turning, so i entered code into my module class to display the hourglass mouse pointer with the following code:

Code:
Private Sub cmdFollowWebsite_Click()

On Error GoTo Err_cmdFollowWebsite_Click

    [COLOR=Red]Screen.MousePointer = 11 ' Sets MousePointer to Hourglass[/COLOR]
    DoCmd.RunCommand acCmdSaveRecord
    FollowHyperlink Me.txtWebsite
    [COLOR=Red]Screen.MousePointer = 0 ' Sets MousePointer to Default[/COLOR]
    
Exit_cmdFollowWebsite_Click:
    Exit Sub

Err_cmdFollowWebsite_Click:
    Select Case Err.Number
       Case 5 'cannot locate the internet server or proxy server. (also address could be wrong)
        Msg = Err.Description & Chr(13) & Chr(13) & "Please check your internet connection." & Chr(13) & "Please check address details."
       Case Else
        Msg = "Error # " & Str(Err.Number) & Chr(13) & Err.Description
    End Select
        MsgBox Msg, vbCritical, "The PED: Internet Error", Err.HelpFile, Err.HelpContext
    Resume Exit_cmdFollowWebsite_Click

End Sub
however, the hourglass pointer doesn't display until the very last fleeting moment where the pointer quickly flashes the hourglass before continuing to open the browser and display the site.

i was wondering what code should i use to get the pointer to display the hourglass immediately after clicking the button?
 

missinglinq

AWF VIP
Local time
Yesterday, 22:05
Joined
Jun 20, 2003
Messages
6,423
Since your line invoking the hour glass is the first code executed when the command button is clicked, I believe you'd have to use a NPCI; Neural-PC-Interface! That way Access would know when the user merely thought about clicking the button, before they actually did so!

Seriously, I suppose you could give it a slight head start by using code to set the hour glass in the command button's MouseMove event, but then it would pop up if the user merely passed the cursor over the button, whether thety clicked it or not. You can reset it to normal when the user moves off of the button, but it will flash temporarily. Levae the code you already have in place.

Turn the hour glass ON
Code:
Private Sub cmdFollowWebsite_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Screen.MousePointer = 11
End Sub
Turn the hour glass OFF
Code:
Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Screen.MousePointer = 0
End Sub
I have to tell you, though, that with the speed of processors today, this kind of thing is usually not needed. The usual question we see is that it doesn't work at all, when, in fact, things are processed so fast that the hour glass appears and disappears too quickly for the human eye/brain to record the fact. Do the users not realize that a connection is being made to a website?
 

jwhite

Software Developer
Local time
Yesterday, 22:05
Joined
Sep 24, 2006
Messages
141
Agree with Missinglinq. Acces does have a command just for hourglass:

DoCmd.Hourglass True
DoCmd.RunCommand acCmdSaveRecord
FollowHyperlink Me.txtWebsite
DoCmd.Hourglass False

If behavior is still like your initial post, put a line with DoEvents before the RunCommand.
 

wiklendt

i recommend chocolate
Local time
Today, 12:05
Joined
Mar 10, 2008
Messages
1,746
Neural-PC-Interface! That way Access would know when the user merely thought about clicking the button, before they actually did so!

ha ha.... :p

The usual question we see is that it doesn't work at all, when, in fact, things are processed so fast that the hour glass appears and disappears too quickly for the human eye/brain to record the fact. Do the users not realize that a connection is being made to a website?

in my case (even though i have an hp pavilion with 2Gb RAM, 2Gb GHz... and under one year old) when i click on the command button to view the website, it can take up to a full 5 seconds before the hourglass is seen, only then is the browser is opened and the connection made. The hourglass *IS* seen, but for the first 4.7s it's still the 'pointy hand' that you see when you hover over links, and THEN the browser opens and THEN it makes connection and loads the website, but this is all AFTER about 5 seconds of apparently no response to the click.

i suppose the user will be able to realise that the program has to send commands to the computer to open the default web browser and then connect to the internet, BUT how often have we all impatiently clicked on a button several times b/c we think it hasn't responded?

i just wanted to let the user know that pressing the button had worked, and things were happening.

i suppose i shouldn't be so perfectionist about it - once the user realises it takes a few seconds the first time, they'll be more aware of it the next time... but still, *whine* i want it perfect! :(

anyway, thanks for trying guys, i guess it's just a quirk in my installation or something... i'll suck it up and live with it - there are more important things to concentrate on. this database is by no means finished!!
 

WayneRyan

AWF VIP
Local time
Today, 03:05
Joined
Nov 19, 2002
Messages
7,122
wik,

From what I've seen so far, maybe you just need a DoEvents command after
the hourglass.

I know if you have VBA code updating form controls, they won't display properly without the DoEvents. Maybe the HourGlass is the same way.

Just a thought, I use Progress Bars (they need DoEvents), but don't use the
HourGlass.

hth,
Wayne
 

missinglinq

AWF VIP
Local time
Yesterday, 22:05
Joined
Jun 20, 2003
Messages
6,423
So you're advocating deliberately delaying the opening of the website in order to show the hour glass whose purpose is to indicate that the website is loading? :eek:
 

wiklendt

i recommend chocolate
Local time
Today, 12:05
Joined
Mar 10, 2008
Messages
1,746
No, what i want to happen is:

while we wait for the browser to open, instead of access displaying the pointing cursor, i want it instead to display the hourglass cursor. i don't want to delay anything, i want it simply to diplay a different cursor while it's going it.

effectively: instead of someone thinking their click did nothing, i want them to know their click is being processed.

even if it does delay the website, i don't mind if this delays the process by 1 or 2 seconds, because if it works, the hourglass cursor would be keeping the user informed rather than going "and now what..." b/c the delay already is 5 seconds WITHOUT any acknowledgement by the software that it's received and processing user input.
 

Mike375

Registered User.
Local time
Today, 12:05
Joined
Aug 28, 2008
Messages
2,548
I use this for the start of a back system. It appears straight away.

DoCmd.RunMacro "Macro2", , ""
DoCmd.OpenForm "BUExp", acNormal, "", "", , acNormal
DoCmd.GoToRecord , "", acNewRec
Forms!BUExp!DiskBU = "Backup has started"

Macro is Echo Yes. I have had trouble with Echo True in code and fouling up things and so stick with the macro.
 

bsacheri

New member
Local time
Yesterday, 22:05
Joined
Aug 9, 2017
Messages
12
Re: hourglass delay from hyperlink click

Skipping ahead 10 years....I wanted to chime in on this old thread in case anyone has come up with a working solution or is searching for one. I think I'm in the same boat as the OP. I suspect there is a bug with the way Access handles the hyperlink mouse pointer.



I have a textbox that contains the words "GoTo", formatted as a hyperlink. The form has other bound textboxes and is displayed in Datasheet view. Because the GoTo textbox is formatted as a hyperlink, the hand cursor is shown on mouse over.
In the OnClick event of the GoTo textbox I am calling a common subroutine that launches another form based on the selected row. It takes a 5-10 seconds for that form to open. I have set DoCmd.Hourglass True followed by DoEvents before launching the form, but the mouse pointer stays at the hand until the form is almost open.

I have tried turning the hourglass off and back on, adding delays, toggling Echo, and multiple DoEvents. Debug.Print Screen.MousePointer will return 11 but the mouse pointer still looks like the hand. :banghead:

I am long time developer who has inherited this application. It is full of forms displayed as datasheets with these textbox GoTo hyperlinks (50+ forms). The application is getting a lot more WAN usage nowadays so the delays are more noticeable. Reprogramming these textboxes to have a simulated mouse hover effect is not practical, and may not even work in a datasheet. Most of the click events call a common subroutine, so that's where I'd like to force the mouse pointer to change with VBA.

If you have any ideas or solutions, please reply.
 

isladogs

MVP / VIP
Local time
Today, 03:05
Joined
Jan 14, 2017
Messages
18,261
Hello and welcome to the forum.

On a quick read, I think the earlier posts seem to be referring to external links whereas your post refers to links to other forms in your database.

Is what you have anything like the attached screenshot.
Its from an interactive help feature I built for one of my schools apps.
It contains 350+ topics, each of which has a GoTo button that takes users direct to the relevant form (or report etc) for that topic

The code used is identical to that where the same item is opened via the main menu or admin form. So it doesn't use Application.FollowHyperlink and doesn't have any of the code you're using as a sticking plaster

It usually takes about 2 seconds to open the relevant item and I have the spinning circle whilst that happens (rather than the hourglass).
Its used on various LANs each with 200 or more users for much of the working day - but never on a WAN.
As you may know Access does not work well on a WAN.

Hope that helps ...even if only indirectly
 

Attachments

  • Capture.PNG
    Capture.PNG
    87.3 KB · Views: 116

bsacheri

New member
Local time
Yesterday, 22:05
Joined
Aug 9, 2017
Messages
12
I have an image to show but I'm new to this forum so I'm unable to add hyperlinks or images until I post 10 times. I've been using VB/Access for a long time.

The "GoTo" is static text in a textbox control. The control is formatted as a Hyperlink to make it appear blue with an underline, and show the user a hand icon when they mouse over it. That’s the extent of how I'm using it as a hyperlink. The textbox has a Click() event and that's what I'm using to open another form. I’m not using the FollowHyperlink feature.

So, in my click event, I call a function that turns on the hourglass (spinning circle in Windows 10) and opens the appropriate form. If it takes 10 seconds for the form to open, the mouse cursor will show the hand icon for the first 8-9 seconds. At some point when the destination form is opening, Access stops showing the hand and the hourglass cursor is shown.

This is not a WAN/LAN issue, but the effect is more prominent to users at a distance or when the network is slow.

I appreciate your prompt response though I didn't get any new insight from it.
 

isladogs

MVP / VIP
Local time
Today, 03:05
Joined
Jan 14, 2017
Messages
18,261
You can attach your image if you zip it.
Suggest you post the code used as well
If it helps, you can also attach your DB if it is zipped and reduced in size to below 2MB
 

bsacheri

New member
Local time
Yesterday, 22:05
Joined
Aug 9, 2017
Messages
12
It is unfortunate that I can't post links here. I found a solution on another forum. If you want to see it, go to UtterAccess and search for "Mouse Pointer Won't Change To Hourglass, Access 2010"

There you will find an API routine there that will change the mouse pointer and it defeats the Access glitch with the hyperlink hand cursor.

Thank you for your willingness to help.
 

isladogs

MVP / VIP
Local time
Today, 03:05
Joined
Jan 14, 2017
Messages
18,261
I NEVER use the hyperlink datatype as I find them awkward to work with.
However, I've just done a sample database to test the issue reported by the OP.

I tested both URLs and files on my PC.

Perhaps I'm missing something but I can't replicate the issue.
Hover over the hyperlink and the cursor changes to a hand as it should.
Click on the link and it opens successfully and with no noticeable delay.

I didn't use missinglinq's code as I didn't need to do so
Apart from the fact that I'm not on a WAN, what else is different?
 

Attachments

  • HyperlinksTest.zip
    21.3 KB · Views: 84

Users who are viewing this thread

Top Bottom