hourglass

S

Sandy

Hi all. I am working in A2k and having trouble with hourglass.

I have a form which takes several seconds to load, so I want the mouse
pointer to turn to an hourlgass when the menu item is clicked to open the
form, and then back to regular pointer when the form activates.

From the main menu:
Private Sub Label141_Click()
DoCmd.Hourglass True
DoCmd.OpenForm ("frmLookupSrch")
End Sub

Then in frmLookupSrch:
Private Sub Form_Activate()
DoCmd.Hourglass False
End Sub

Using this code, the mouse pointer never turns to an hourglass. I tried
just the hourglass code alone, and it works fine (turns to hourglass the
instant I click the menu label). I even tried writing it so that it runs
hourglass and then goes to a separate event statement (Label141_Click_A) to
open the form, but still the hourglass will not show.

Please help me before I drop-kick my pc.

TIA, Sandy
 
K

Klatuu

I don't know if this will work, but try reversing your statments.
DoCmd.OpenForm ("frmLookupSrch")
DoCmd.Hourglass True
 
S

Sandy

I would have never thought of that! But it didn't work anyway... reversing
the statements made the pointer turn to hourglass and stay that way. The
form activate code didn't turn it back :(
 
K

Klatuu

Be sure when you are turning it off, set it to False :)
(sorry, but sometimes we all miss the obvious)
Try changing to the Open or Load events of the form.
 
S

Sandy

I didn't change the form activate code, so it was still set to hourglass =
false.

I have tried it on Open, Load, and now Activate... every possible way I
could think of before coming here to ask for help. This is why I am so
frustrated at this point, because this seems so simple and yet doesn't work
any way I try it.

Thanks for your suggestions though, and if you have any more (or anyone else
does) I'd appreciate hearing them.
 
S

Sandy

Thanks Ron, but I actually tried that just this morning after seeing it in
another hourlgass post. Still no bueno.
 
D

Dirk Goldgar

Sandy said:
Hi all. I am working in A2k and having trouble with hourglass.

I have a form which takes several seconds to load, so I want the mouse
pointer to turn to an hourlgass when the menu item is clicked to open
the form, and then back to regular pointer when the form activates.

From the main menu:
Private Sub Label141_Click()
DoCmd.Hourglass True
DoCmd.OpenForm ("frmLookupSrch")
End Sub

Then in frmLookupSrch:
Private Sub Form_Activate()
DoCmd.Hourglass False
End Sub

Using this code, the mouse pointer never turns to an hourglass. I
tried just the hourglass code alone, and it works fine (turns to
hourglass the instant I click the menu label). I even tried writing
it so that it runs hourglass and then goes to a separate event
statement (Label141_Click_A) to open the form, but still the
hourglass will not show.

Try inserting a DoEvents statement:

Private Sub Label141_Click()
DoCmd.Hourglass True
DoEvents
DoCmd.OpenForm ("frmLookupSrch")
End Sub
 
S

Sandy

Hi Dirk,

Don't know if you'll even see this almost two weeks later, but I tried your
suggestion and still the hourglass never shows.

I did notice though that if I go to another window (another open app,
desktop, internet, anywhere else but Access), when I come back the hourglass
is displayed. Of course, that's not going to be the usual way people do
things, so not very helpful there.

Maybe it would help if you knew that the db is running queries during
opening of form. I have the same problem with another form that also runs
queries; however, the second form is supposed to change a label to show
what's happening, then run a query, then change label for next action, run
another query, etc. Those labels also seem to be lagging in that the first
change doesn't happen until after the first query is run, even though the
code is written in the opposite order.

Any help is appreciated.

TIA, Sandy
 
D

Dirk Goldgar

Sandy said:
Hi Dirk,

Don't know if you'll even see this almost two weeks later, but I
tried your suggestion and still the hourglass never shows.

I did notice though that if I go to another window (another open app,
desktop, internet, anywhere else but Access), when I come back the
hourglass is displayed. Of course, that's not going to be the usual
way people do things, so not very helpful there.

Maybe it would help if you knew that the db is running queries during
opening of form. I have the same problem with another form that also
runs queries; however, the second form is supposed to change a label
to show what's happening, then run a query, then change label for
next action, run another query, etc. Those labels also seem to be
lagging in that the first change doesn't happen until after the first
query is run, even though the code is written in the opposite order.

Sandy -

I think I'm going to need to see what code you have in the form's Open
event. Just opening a form with a long-running recordsource query
shouldn't cause this problem; in fact, when I open such a form, I get
an hourglass display automatically, while Access runs the recordsource
query.

So please post the code that you have in the form's Open event. It may
be that the form's Activate event fires, turning off the hourglass,
before whatever you're doing in the form's Open event is done.
 
S

Sandy

:
Sandy -
I think I'm going to need to see what code you have in the form's Open
event. Just opening a form with a long-running recordsource query
shouldn't cause this problem; in fact, when I open such a form, I get
an hourglass display automatically, while Access runs the recordsource
query.

So please post the code that you have in the form's Open event. It may
be that the form's Activate event fires, turning off the hourglass,
before whatever you're doing in the form's Open event is done.

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Dirk,

There is no code in the main form's Open event. This search form I have
built is an unbound form with where user selects if they are seaching for a
Name, Address, or Phone/Fax number, then they type the data they are
searching for.

The main (unbound) form has three subforms, each of which are based on union
queries to display all possible names, address, phone/fax numbers
respectively (since this information can come from more than one table,
different fields, etc). After user selects the data type and inputs search
criteria, they click a Search button with displays the proper subform and
requeries it for the search data.

The three subforms all have Open event code, but it is only OrderBy
instructions for each. Opening the main form automatically causes the
subforms to load, which is what is taking 32 seconds... But when user clicks
the menu label to open the main form, it appears as though nothing is
happening (unless they look at bottom left corner of app window to see
Calculating... / Running Query status bar).

This is really just an aesthetics problem more than user complaints, it's
just irksome that seemingly simple code doesn't work.

TIA for any other suggestions,
Sandy
 
S

Sandy

Dirk,

There is no code in the main form's Open event.

The main form is unbound with three subforms based on union queries. User
selects which type of data they want to search for (Name, Address,
Phone/Fax), then they type search criteria and click a button which displays
the appropriate subform and requeries it for search data.

The three subforms each have Open event codes, but only OrderBy
instructions. When the main form is opened, it takes 32 seconds for the
three subforms to get loaded, and the only way to know anything is happening
is if user happens to notice "Calculating... / Running query" status bar at
bottom left corner of app.

This is really just an aesthetics problem, but it is especially irksome when
such seemingly simple code doesn't work. I do not know why the db doesn't
automatically display the hourglass on just this form/function; it works
properly elsewhere without code intervention.

TIA again for any other suggestions,
Sandy
 
S

Sandy

Dirk,

There is no code in the main form's Open event.

The main form is unbound with three subforms based on union queries. User
selects which type of data they want to search for (Name, Address,
Phone/Fax), then they type search criteria and click a button which displays
the appropriate subform and requeries it for search data.

The three subforms each have Open event codes, but only OrderBy
instructions. When the main form is opened, it takes 32 seconds for the
three subforms to get loaded, and the only way to know anything is happening
is if user happens to notice "Calculating... / Running query" status bar at
bottom left corner of app.

This is really just an aesthetics problem, but it is especially irksome when
such seemingly simple code doesn't work. I do not know why the db doesn't
automatically display the hourglass on just this form/function; it works
properly elsewhere without code intervention.

TIA again for any other suggestions,
Sandy
 
S

Sandy

(Don't you just hate it when MS says there was an error on reply, so you
repost, then get another error message, repost again, then all three
responses show up...?)

Sorry about that... please see first response for most details.
 
D

Dirk Goldgar

Sandy said:
There is no code in the main form's Open event. This search form I
have built is an unbound form with where user selects if they are
seaching for a Name, Address, or Phone/Fax number, then they type the
data they are searching for.

The main (unbound) form has three subforms, each of which are based
on union queries to display all possible names, address, phone/fax
numbers respectively (since this information can come from more than
one table, different fields, etc). After user selects the data type
and inputs search criteria, they click a Search button with displays
the proper subform and requeries it for the search data.

The three subforms all have Open event code, but it is only OrderBy
instructions for each. Opening the main form automatically causes the
subforms to load, which is what is taking 32 seconds... But when user
clicks the menu label to open the main form, it appears as though
nothing is happening (unless they look at bottom left corner of app
window to see Calculating... / Running Query status bar).

This is really just an aesthetics problem more than user complaints,
it's just irksome that seemingly simple code doesn't work.

That gives a bit more info, and it's probably significant that, when you
open a main form and a subform, the subform's Open event fires first.
Setting the subform's OrderBy property probably forces the form to wait
while the query is run, but I'm not sure what effect this all has. I
suspect we're getting into an unexpected sequence of events.

Workaround-wise, you might see if opening a "Please Wait" form works
better for your purposes. You may need to establish some way for the
main form to know when all the subforms are done with their queries,
rather than waiting for the Activate event.

But I'm interested in this problem. If you'd like to send me a copy of
your database, containing only the elements necessary to demonstrate the
problem, I'll have a look at it and see what I can do, time permitting.
You can send it to the address derived by removing NO SPAM and
".invalid" from the reply address of this message. If that address
isn't visible to you, you can get my address from my web site, which is
listed in my sig. Do *not* post my real address in the newsgroup -- I
don't want to be buried in spam and viruses.
 
S

Sandy

Sandy said:
That gives a bit more info, and it's probably significant that, when you
open a main form and a subform, the subform's Open event fires first.
Setting the subform's OrderBy property probably forces the form to wait
while the query is run, but I'm not sure what effect this all has. I
suspect we're getting into an unexpected sequence of events.

Workaround-wise, you might see if opening a "Please Wait" form works
better for your purposes. You may need to establish some way for the
main form to know when all the subforms are done with their queries,
rather than waiting for the Activate event.

But I'm interested in this problem. If you'd like to send me a copy of
your database, containing only the elements necessary to demonstrate the
problem, I'll have a look at it and see what I can do, time permitting.
You can send it to the address derived by removing NO SPAM and
".invalid" from the reply address of this message. If that address
isn't visible to you, you can get my address from my web site, which is
listed in my sig. Do *not* post my real address in the newsgroup -- I
don't want to be buried in spam and viruses.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Dirk,

I will see about sending you the db, but it will take a day or three because
I will need to convert it to Access only (currently A2k front end w/SQL2k
back end using linked tables)--and of course not including all the stuff you
don't need, especially since the current compacted front-end size is
26Mb--and on top of my other duties here, natch.

Obviously I understand you have work to do too, so no rush of course.
Thanks for your help and suggestions, I really do appreciate it.

TIA and I hope it doesn't drive you crazy too,
Sandy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top