How do I get the hourglass to show?

T

Tony Williams

I have a command button that runs a query through a table with about 250,000
records. I want the hourglass while the query is running to show the user
that something is happening. This is my code but it doesn't work.
Private Sub btnShowAll_Click()
DoCmd.Hourglass True
'show all button
Me.RecordSource = "Select * FROM [qryvehicle]"

Me.txtSearch.SetFocus
Me.btnShowAll.Visible = False
Me.lblSearch.Visible = True
DoCmd.Hourglass False


End Sub

Can anyone help please?
Thanks
Tony
 
C

Carl Rapson

All I can think of is to try putting the line

DoEvents

right after the 'DoCmd.Hourglass True' statement. Sometimes Windows needs a
chance to make the change, and Access won't allow it if you don't force it
to.


Carl Rapson
 
T

Tony Williams

Thanks for the suggetsion Carl, I tried that and it still didn't appear?
Odd?
Tony

Carl Rapson said:
All I can think of is to try putting the line

DoEvents

right after the 'DoCmd.Hourglass True' statement. Sometimes Windows needs a
chance to make the change, and Access won't allow it if you don't force it
to.


Carl Rapson

Tony Williams said:
I have a command button that runs a query through a table with about
250,000
records. I want the hourglass while the query is running to show the user
that something is happening. This is my code but it doesn't work.
Private Sub btnShowAll_Click()
DoCmd.Hourglass True
'show all button
Me.RecordSource = "Select * FROM [qryvehicle]"

Me.txtSearch.SetFocus
Me.btnShowAll.Visible = False
Me.lblSearch.Visible = True
DoCmd.Hourglass False


End Sub

Can anyone help please?
Thanks
Tony
 
M

Michael J. Strickland

Tony Williams said:
I have a command button that runs a query through a table with about
250,000
records. I want the hourglass while the query is running to show the
user
that something is happening. This is my code but it doesn't work.
Private Sub btnShowAll_Click()
DoCmd.Hourglass True
'show all button
Me.RecordSource = "Select * FROM [qryvehicle]"

Me.txtSearch.SetFocus
Me.btnShowAll.Visible = False
Me.lblSearch.Visible = True
DoCmd.Hourglass False


End Sub

Can anyone help please?
Thanks
Tony


Not sure what's wrong but you might try:

Screen.MousePointer = 11 ' hourglass pointer
Screen.MousePointer = 0 ' default pointer

for you hourglass.



--
 
T

Tony Williams

Thanks Michael I'll try that and come back if there's a problem
Tony

Michael J. Strickland said:
Tony Williams said:
I have a command button that runs a query through a table with about
250,000
records. I want the hourglass while the query is running to show the
user
that something is happening. This is my code but it doesn't work.
Private Sub btnShowAll_Click()
DoCmd.Hourglass True
'show all button
Me.RecordSource = "Select * FROM [qryvehicle]"

Me.txtSearch.SetFocus
Me.btnShowAll.Visible = False
Me.lblSearch.Visible = True
DoCmd.Hourglass False


End Sub

Can anyone help please?
Thanks
Tony


Not sure what's wrong but you might try:

Screen.MousePointer = 11 ' hourglass pointer
Screen.MousePointer = 0 ' default pointer

for you hourglass.



--
 
M

Mike Painter

Put a doevents after the SQL statement and a msgbox "all done" after that.
It might be that it's happening to fast for the hourglass to show and this
will tell you.
I suspect all Access would do in this case is open the key index file.
I've run two complex queries, one of which used a Cartesian set against some
fairly large files and the results were back in a second or less.

Tony said:
Thanks for the suggetsion Carl, I tried that and it still didn't
appear? Odd?
Tony

Carl Rapson said:
All I can think of is to try putting the line

DoEvents

right after the 'DoCmd.Hourglass True' statement. Sometimes Windows
needs a chance to make the change, and Access won't allow it if you
don't force it to.


Carl Rapson

Tony Williams said:
I have a command button that runs a query through a table with about
250,000
records. I want the hourglass while the query is running to show
the user that something is happening. This is my code but it
doesn't work. Private Sub btnShowAll_Click()
DoCmd.Hourglass True
'show all button
Me.RecordSource = "Select * FROM [qryvehicle]"

Me.txtSearch.SetFocus
Me.btnShowAll.Visible = False
Me.lblSearch.Visible = True
DoCmd.Hourglass False


End Sub

Can anyone help please?
Thanks
Tony
 

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