Showing the Hourglass (A2003)

C

Clif McIrvin

I'm trying to use the hourglass icon to signal activity while applying a
new filter and/or sort to my form's recordset.

Today I noticed that the hourglass doesn't always appear; so far I've
not discovered why the cursor changes sometimes and sometimes not.

Perhaps this is a clue: the sub procedure that modifies the sort and
filter properties can be called from a combo box after update event, a
command button click event or an unassociated label click event. It
appears that I get the hourglass from either the combo box or command
button events, but not the label event.

Here's a code snippet from the called procedure:

DoCmd.Hourglass True
dp "Hourglass True"
Me.Repaint
Application.Echo False

(dp is a sub I wrote to execute a debug.print with a standardized
format.)

the debug.print is executed as expected.

Ideas?
 
A

Arvin Meyer [MVP]

I couldn't duplicate your hourglass problem, so either Echo False is causing
the problem, or you are trying to run code on an associated (sticky) label,
which doesn't have events. Can you post the more of the code?
 
M

M.L. Sco Scofield

Clif,

Long shot. Sometimes I've found that DoEvents will force a screen update
when nothing else will. No promises, but give it a try.

Good luck.

Sco

M.L. "Sco" Scofield, MCSD, MCP, MSS, A+, Access MVP 2001 - 2005
Denver Area Access Users Group Past President 2006/2007 www.DAAUG.org
MS Colorado Events Administrator www.MSColoradoEvents.com
This email made with 100% recycled electrons!
Miscellaneous Access "stuff" at www.ScoBiz.com
 
C

Clif McIrvin

M.L. Sco Scofield said:
Clif,

Long shot. Sometimes I've found that DoEvents will force a screen
update when nothing else will. No promises, but give it a try.

Good luck.

Sco
Thought of that already ... no go.

Thanks anyway!
 
B

Bob Larson

Instead of DoCmd.Hourglass True, try using Screen.MousePointer = 11 and
then to reset use Screen.MousePointer = 1

Also, where are you including this? You should probably do it BEFORE you do
any other code in that event.

--

Thanks,

Bob Larson
Access MVP

Free Access Tutorials and Resources: http://www.btabdevelopment.com
 
C

Clif McIrvin

Thanks for the tip. Unfortunately, it didn't change the behavior.

There are seven different controls on this form that all execute a bit
of setup code -- setting or clearing one or more variables and / or
combo box values, then call a common sub procedure: ApplyFilter.

ApplyFilter builds string varaibles for the filter and sort properties,
then executes the sample code in my OP, sets the filter and sort
properties, then reverses said sample code.

(I posted the complete code in a later post this afternoon.)

This isn't a show-stopper; but it is a bit of an irritation.

Thanks again for chiming in <g>
 
A

Arvin Meyer [MVP]

The code appears OK. I did notice an unrelated possible problem, depending
upon your version:

Application.Quit

should be changed to:

DoCmd.Quit

but that is unrelated to your problem. If you are not throwing errors, I'm
not sure what to do. Try setting a breakpoint and stepping through the code.
You could also try an old debugging procedure which is to throw up a message
box instead of the problem code and see if it fires.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Clif McIrvin said:
Arvin, thanks for taking a look.

I removed the Echo False and it didn't appear to make any difference.

On the form itself, the unassociated labels are sitting in the same
location as the corresponding associated label. The unassociated lable has
visible True, the associated lable has visible False.

Here's the code:

Option Compare Database
Option Explicit

Private Const Rev As String = "(12412)" 'mmddhh of last revision
' Revision History
' 1/24/09 Revise "Show All" behavior
' 12/24/08 Revise Sort Orders
' 11/07/08 Add test for empty recordset to ApplyFilter
' 09/29/08 Change test date sort order
' 08/29/08 Add Include Scheduled Filter
' 08/15/08 Finish initial testing


Dim sqlTestDate As String 'Filter Criteria for TestDate
Dim sqlSampleDate As String 'Filter Criteria for SampleDate
Dim sqlLocation As String 'Filter Criteria for Location
Dim sqlSchedule As String 'Filter Criteria for ShowSchedule
Dim sFilter As String 'Assembled Filter Criteria
Dim sOrder As String 'Order By Crititeria
Dim bTestDate As Boolean 'Sort All by Test Date
Private Sub cboLocation_AfterUpdate()
ApplyFilter
End Sub

Private Sub cboSampleDate_AfterUpdate()
Me.cboTestDate = Null
ApplyFilter
End Sub

Private Sub cboTestDate_AfterUpdate()
Me.cboSampleDate = Null
ApplyFilter
End Sub

Private Sub cmdReturn_Click()
DoCmd.Close , , acSaveNo
If FormLoaded("Hidden Form") Then
DoCmd.Close acForm, "Hidden Form", acSaveNo
Application.Quit
End If
End Sub

Private Sub cmdShowAll_Click()
Me.cboLocation.Value = Null
Me.cboSampleDate = Null
Me.cboTestDate = Null
bTestDate = False
ApplyFilter
End Sub

Private Sub cmdShowScheduled_Click()
' Toggle state of ShowScheduled satus
With Me.cmdShowScheduled
If .Tag = True Then
.Tag = False
.Caption = "Includ&E Scheduled"
.ForeColor = cmDkRed 'Dk Red
sqlSchedule = "[PSI] Is Not Null"
Else
.Tag = True
.Caption = "Remov&E Scheduled"
.ForeColor = cmTeal 'Teal
sqlSchedule = ""
End If
End With
ApplyFilter
End Sub

Private Sub Form_Load()
Me.Caption = "MCSS Cylinder Data " & Rev
Me.cboTestDate = Date - 14
Me.InsideHeight = 7635 'twips
Me.cmdShowScheduled.Tag = True
cmdShowScheduled_Click 'Toggle status and apply filter
End Sub

Private Sub ApplyFilter()
' Test Date and Location may be combined,
' sort on Test Date, Location, Pour Height.
' Location and Sample Date may be combined,
' sort on Location, Sample Date, Pour Height, Age.
' Show All sort on Location, Sample Date, Pour Height, Age.
' After Update code for either date sets the other
' date to Null.
' Show Scheduled is always combined with other filters,
' and is set by OnClick event.

' 1/24/09 Show All Click now resets both date filters.

' 12/24/08 revise Sort Order
' Sample was: Location, Sample Date, Test Date.
' Test was: Test Date, Location.

' Get Combo Box Values
sqlLocation = ""
If Not IsNull(Me.cboLocation.Value) Then
sqlLocation = BuildCriteria("[Location]", dbText, _
Replace(Me.cboLocation.Value, ",", "?"))
End If
sqlSampleDate = ""
If Not IsNull(Me.cboSampleDate.Value) Then
sqlSampleDate = BuildCriteria("[Sample Date]", dbDate, _
">=" & Me.cboSampleDate.Value)
End If
sqlTestDate = ""
If Not IsNull(Me.cboTestDate.Value) Then
sqlTestDate = BuildCriteria("[Test Date]", dbDate, _
">=" & Me.cboTestDate.Value)
End If

' Set Default Criteria
sFilter = ""
sOrder = "[Location],[Sample Date],[Pour Height],[Age]"

If sqlSampleDate <> "" Then
sFilter = "(" & sqlSampleDate & ")"
sOrder = "[Location],[Sample Date],[Pour Height],[Age]"
End If

If sqlTestDate <> "" Then
sFilter = "(" & sqlTestDate & ")"
sOrder = "[Test Date],[Location],[Pour Height]"
End If

If bTestDate Then
sOrder = "[Test Date],[Location],[Pour Height]"
End If

If sqlLocation <> "" Then
If sFilter <> "" Then
sFilter = sFilter & " AND (" & sqlLocation & ")"
Else
sFilter = "(" & sqlLocation & ")"
End If
End If

If sqlSchedule <> "" Then
If sFilter <> "" Then
sFilter = sFilter & " AND (" & sqlSchedule & ")"
Else
sFilter = "(" & sqlSchedule & ")"
End If
End If

' Debug.Print sFilter
' Debug.Print sOrder

DoCmd.Hourglass True
'dp "Hourglass True"
Me.Repaint
Application.Echo False
With Me.MCSS_Recent_Breaks.Form
If sFilter <> "" Then
.Filter = sFilter
.FilterOn = True
Else
.FilterOn = False
End If
.OrderBy = sOrder
.OrderByOn = True
If .Recordset.RecordCount > 0 Then
.Recordset.MoveLast
Me.MCSS_Recent_Breaks.SetFocus
.Test_Date.SetFocus
End If
End With
Application.Echo True
Me.Repaint
DoCmd.Hourglass False
End Sub

Private Sub Location_Label_Click()
Me.cboLocation.Value = Null
ApplyFilter
End Sub

Private Sub Sample_Date_Label_Click()
Me.cboTestDate.Value = Null
Me.cboSampleDate.Value = Null
bTestDate = False
ApplyFilter
End Sub

Private Sub Test_Date_Label_Click()
Me.cboSampleDate.Value = Null
Me.cboTestDate.Value = Null
bTestDate = True
ApplyFilter
End Sub




Arvin Meyer said:
I couldn't duplicate your hourglass problem, so either Echo False is
causing the problem, or you are trying to run code on an associated
(sticky) label, which doesn't have events. Can you post the more of the
code?
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
C

Clif McIrvin

Thanks for taking the time to review the code - I really appreciate it!

I take it DoCmd.Quit is more stable across versions? Application .Quit
seems to work well on A2003 ... I can certainly make that change.

While pondering this issue it occurred to me to place a .Visible = False
label on the form with the caption "Working ..." and toggle the visible
property. Works like a charm. I believe I'll simply abandon this
question as unresolved and not worth the time required to discover the
why behind it.

Someday I may try to remember why I used unassociated labels instead of
command buttons ... I couldn't remember why I did that -- perhaps
because I didn't like the <Enter> behavior of command buttons in this
case.

Thanks again for your time and advice!

--
Clif

Arvin Meyer said:
The code appears OK. I did notice an unrelated possible problem,
depending upon your version:

Application.Quit

should be changed to:

DoCmd.Quit

but that is unrelated to your problem. If you are not throwing errors,
I'm not sure what to do. Try setting a breakpoint and stepping through
the code. You could also try an old debugging procedure which is to
throw up a message box instead of the problem code and see if it
fires.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Clif McIrvin said:
Arvin, thanks for taking a look.

I removed the Echo False and it didn't appear to make any difference.

On the form itself, the unassociated labels are sitting in the same
location as the corresponding associated label. The unassociated
lable has visible True, the associated lable has visible False.
 
A

Arvin Meyer [MVP]

I use labels as "hover" buttons all the time. It makes a clean interface if
the image is flat and changes to raised and a different color when the mouse
moves over it, then moves to a sunken position when clicked. See:

http://www.datastrat.com/Download/MouseMove.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Clif McIrvin said:
Thanks for taking the time to review the code - I really appreciate it!

I take it DoCmd.Quit is more stable across versions? Application .Quit
seems to work well on A2003 ... I can certainly make that change.

While pondering this issue it occurred to me to place a .Visible = False
label on the form with the caption "Working ..." and toggle the visible
property. Works like a charm. I believe I'll simply abandon this
question as unresolved and not worth the time required to discover the why
behind it.

Someday I may try to remember why I used unassociated labels instead of
command buttons ... I couldn't remember why I did that -- perhaps because
I didn't like the <Enter> behavior of command buttons in this case.

Thanks again for your time and advice!

--
Clif

Arvin Meyer said:
The code appears OK. I did notice an unrelated possible problem,
depending upon your version:

Application.Quit

should be changed to:

DoCmd.Quit

but that is unrelated to your problem. If you are not throwing errors,
I'm not sure what to do. Try setting a breakpoint and stepping through
the code. You could also try an old debugging procedure which is to throw
up a message box instead of the problem code and see if it fires.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Clif McIrvin said:
Arvin, thanks for taking a look.

I removed the Echo False and it didn't appear to make any difference.

On the form itself, the unassociated labels are sitting in the same
location as the corresponding associated label. The unassociated lable
has visible True, the associated lable has visible False.
 

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

Similar Threads


Top