Connecting Tech Pros Worldwide Forums | Help | Site Map

Delay of Hourglass

Henry Stockbridge
Guest
 
Posts: n/a
#1: Apr 4 '06
Hi,

I am running the following code and the visibility of the Hourglass
appears late, instead of immediately. Any ideas of how I can remedy
this?

=============

Private Sub lblUpdateMDList_Click()

Docmd.Hourglass True

Dim dbs As DAO.Database
Dim sSQL As String

Set dbs = CurrentDb()

' 1) Delete and append records
sSQL = "DROP TABLE tblRepLookUp"
dbs.Execute sSQL
sSQL = "SELECT qryMDHospRep.hosCustomerID, "
sSQL = sSQL & "qryMDHospRep.phyPhysicianID, "
sSQL = sSQL & "qryMDHospRep.SalesRepID, qryMDHospRep."
sSQL = sSQL & "SalesRepFirstName, qryMDHospRep."
sSQL = sSQL & "SalesRepLastName, qryMDHospRep.SalesRep, "
sSQL = sSQL & "qryMDHospRep.SalesRepType, qryMDHospRep."
sSQL = sSQL & "RegionRepID, qryMDHospRep."
sSQL = sSQL & "RegionManagerFirstName, qryMDHospRep."
sSQL = sSQL & "RegionManagerLastName, qryMDHospRep."
sSQL = sSQL & "RegionManager INTO tblRepLookUp "
sSQL = sSQL & "FROM qryMDHospRep;"

dbs.Execute sSQL

Docmd.Hourglass False

MsgBox "Physician List Complete", vbInformation + vbOKOnly, "Process
Complete"
Set dbs = Nothing

End Sub

====================

Thanks in advance,

Henry


tommaso.gastaldi@uniroma1.it
Guest
 
Posts: n/a
#2: Apr 4 '06

re: Delay of Hourglass


hi Henry ,

in the .Net languages I have seen often the following schema:

Application.DoEvents()
Cursor.Current = Cursors.WaitCursor

' ... intensive task here ...

Cursor.Current = Cursors.Default
Application.DoEvents()

can you do something similar in the language you are you using ? Le me
know...

-t

Henry Stockbridge ha scritto:
[color=blue]
> Hi,
>
> I am running the following code and the visibility of the Hourglass
> appears late, instead of immediately. Any ideas of how I can remedy
> this?
>
> =============
>
> Private Sub lblUpdateMDList_Click()
>
> Docmd.Hourglass True
>
> Dim dbs As DAO.Database
> Dim sSQL As String
>
> Set dbs = CurrentDb()
>
> ' 1) Delete and append records
> sSQL = "DROP TABLE tblRepLookUp"
> dbs.Execute sSQL
> sSQL = "SELECT qryMDHospRep.hosCustomerID, "
> sSQL = sSQL & "qryMDHospRep.phyPhysicianID, "
> sSQL = sSQL & "qryMDHospRep.SalesRepID, qryMDHospRep."
> sSQL = sSQL & "SalesRepFirstName, qryMDHospRep."
> sSQL = sSQL & "SalesRepLastName, qryMDHospRep.SalesRep, "
> sSQL = sSQL & "qryMDHospRep.SalesRepType, qryMDHospRep."
> sSQL = sSQL & "RegionRepID, qryMDHospRep."
> sSQL = sSQL & "RegionManagerFirstName, qryMDHospRep."
> sSQL = sSQL & "RegionManagerLastName, qryMDHospRep."
> sSQL = sSQL & "RegionManager INTO tblRepLookUp "
> sSQL = sSQL & "FROM qryMDHospRep;"
>
> dbs.Execute sSQL
>
> Docmd.Hourglass False
>
> MsgBox "Physician List Complete", vbInformation + vbOKOnly, "Process
> Complete"
> Set dbs = Nothing
>
> End Sub
>
> ====================
>
> Thanks in advance,
>
> Henry[/color]

Bob Quintal
Guest
 
Posts: n/a
#3: Apr 4 '06

re: Delay of Hourglass


tommaso.gastaldi@uniroma1.it wrote in
news:1144180970.674314.206570@g10g2000cwb.googlegr oups.com:
[color=blue]
> hi Henry ,
>
> in the .Net languages I have seen often the following schema:
>
> Application.DoEvents()
> Cursor.Current = Cursors.WaitCursor
>
> ' ... intensive task here ...
>
> Cursor.Current = Cursors.Default
> Application.DoEvents()
>
> can you do something similar in the language you are you using
> ? Le me know...
>
> -t[/color]

Doevents is all one needs in VBA.

Docmd.Hourglass True
DoEvents

Dim dbs As DAO.Database
Dim sSQL As String

Set dbs = CurrentDb()

Q
[color=blue]
>
> Henry Stockbridge ha scritto:
>[color=green]
>> Hi,
>>
>> I am running the following code and the visibility of the
>> Hourglass appears late, instead of immediately. Any ideas of
>> how I can remedy this?
>>
>> =============
>>
>> Private Sub lblUpdateMDList_Click()
>>
>> Docmd.Hourglass True
>>
>> Dim dbs As DAO.Database
>> Dim sSQL As String
>>
>> Set dbs = CurrentDb()
>>
>> ' 1) Delete and append records
>> sSQL = "DROP TABLE tblRepLookUp"
>> dbs.Execute sSQL
>> sSQL = "SELECT qryMDHospRep.hosCustomerID, "
>> sSQL = sSQL & "qryMDHospRep.phyPhysicianID, "
>> sSQL = sSQL & "qryMDHospRep.SalesRepID, qryMDHospRep."
>> sSQL = sSQL & "SalesRepFirstName, qryMDHospRep."
>> sSQL = sSQL & "SalesRepLastName, qryMDHospRep.SalesRep, "
>> sSQL = sSQL & "qryMDHospRep.SalesRepType, qryMDHospRep."
>> sSQL = sSQL & "RegionRepID, qryMDHospRep."
>> sSQL = sSQL & "RegionManagerFirstName, qryMDHospRep."
>> sSQL = sSQL & "RegionManagerLastName, qryMDHospRep."
>> sSQL = sSQL & "RegionManager INTO tblRepLookUp "
>> sSQL = sSQL & "FROM qryMDHospRep;"
>>
>> dbs.Execute sSQL
>>
>> Docmd.Hourglass False
>>
>> MsgBox "Physician List Complete", vbInformation +
>> vbOKOnly, "Process
>> Complete"
>> Set dbs = Nothing
>>
>> End Sub
>>
>> ====================
>>
>> Thanks in advance,
>>
>> Henry[/color]
>[/color]



--
Bob Quintal

PA is y I've altered my email address.
tommaso.gastaldi@uniroma1.it
Guest
 
Posts: n/a
#4: Apr 4 '06

re: Delay of Hourglass


Interesting.

It's also remarkable to note how in the .net context it is crucial the
position of the doevents w.r.t. the cursor setting (and this, according
Bob's suggestion, should be different from VBA):

"Note If you call Application.DoEvents before resetting the Current
property back to the Cursors.Default cursor, the application will
resume listening for mouse events and will resume displaying the
appropriate Cursor for each control in the application."

see:
http://msdn.microsoft.com/library/de...ClassTopic.asp

Bob Quintal ha scritto:
[color=blue]
> tommaso.gastaldi@uniroma1.it wrote in
> news:1144180970.674314.206570@g10g2000cwb.googlegr oups.com:
>[color=green]
> > hi Henry ,
> >
> > in the .Net languages I have seen often the following schema:
> >
> > Application.DoEvents()
> > Cursor.Current = Cursors.WaitCursor
> >
> > ' ... intensive task here ...
> >
> > Cursor.Current = Cursors.Default
> > Application.DoEvents()
> >
> > can you do something similar in the language you are you using
> > ? Le me know...
> >
> > -t[/color]
>
> Doevents is all one needs in VBA.
>
> Docmd.Hourglass True
> DoEvents
>
> Dim dbs As DAO.Database
> Dim sSQL As String
>
> Set dbs = CurrentDb()
>
> Q
>[color=green]
> >
> > Henry Stockbridge ha scritto:
> >[color=darkred]
> >> Hi,
> >>
> >> I am running the following code and the visibility of the
> >> Hourglass appears late, instead of immediately. Any ideas of
> >> how I can remedy this?
> >>
> >> =============
> >>
> >> Private Sub lblUpdateMDList_Click()
> >>
> >> Docmd.Hourglass True
> >>
> >> Dim dbs As DAO.Database
> >> Dim sSQL As String
> >>
> >> Set dbs = CurrentDb()
> >>
> >> ' 1) Delete and append records
> >> sSQL = "DROP TABLE tblRepLookUp"
> >> dbs.Execute sSQL
> >> sSQL = "SELECT qryMDHospRep.hosCustomerID, "
> >> sSQL = sSQL & "qryMDHospRep.phyPhysicianID, "
> >> sSQL = sSQL & "qryMDHospRep.SalesRepID, qryMDHospRep."
> >> sSQL = sSQL & "SalesRepFirstName, qryMDHospRep."
> >> sSQL = sSQL & "SalesRepLastName, qryMDHospRep.SalesRep, "
> >> sSQL = sSQL & "qryMDHospRep.SalesRepType, qryMDHospRep."
> >> sSQL = sSQL & "RegionRepID, qryMDHospRep."
> >> sSQL = sSQL & "RegionManagerFirstName, qryMDHospRep."
> >> sSQL = sSQL & "RegionManagerLastName, qryMDHospRep."
> >> sSQL = sSQL & "RegionManager INTO tblRepLookUp "
> >> sSQL = sSQL & "FROM qryMDHospRep;"
> >>
> >> dbs.Execute sSQL
> >>
> >> Docmd.Hourglass False
> >>
> >> MsgBox "Physician List Complete", vbInformation +
> >> vbOKOnly, "Process
> >> Complete"
> >> Set dbs = Nothing
> >>
> >> End Sub
> >>
> >> ====================
> >>
> >> Thanks in advance,
> >>
> >> Henry[/color]
> >[/color]
>
>
>
> --
> Bob Quintal
>
> PA is y I've altered my email address.[/color]

Henry Stockbridge
Guest
 
Posts: n/a
#5: Apr 5 '06

re: Delay of Hourglass


Thanks for the help. - Henry

Henry Stockbridge
Guest
 
Posts: n/a
#6: Apr 5 '06

re: Delay of Hourglass


Thanks for the help. - Henry

Henry Stockbridge
Guest
 
Posts: n/a
#7: Apr 30 '06

re: Delay of Hourglass


Well, I almost had it....

I can trigger the hourglass, but then it disappears, the system looks
like it is idle for 30 seconds or so, and then the Message Box appears.
I would expect something more immediate. Any ideas or solutions?
'====================================
Private Sub lblUpdateMDList_Click()
On Error GoTo PROC_ERR
Dim dbs As DAO.Database
Dim sSql As String
Set dbs = CurrentDb()

DoCmd.Hourglass True
DoEvents

' 1) Delete and append records
sSql = "DROP TABLE tblRepLookUp"
dbs.Execute sSql
sSql = "SELECT qryMDHospRep.hosCustomerID, "
sSql = sSql & "qryMDHospRep.phyPhysicianID, "
sSql = sSql & "qryMDHospRep.SalesRepID, qryMDHospRep."
sSql = sSql & "SalesRepFirstName, qryMDHospRep."
sSql = sSql & "SalesRepLastName, qryMDHospRep.SalesRep, "
sSql = sSql & "qryMDHospRep.SalesRepType, qryMDHospRep."
sSql = sSql & "RegionRepID, qryMDHospRep."
sSql = sSql & "RegionManagerFirstName, qryMDHospRep."
sSql = sSql & "RegionManagerLastName, qryMDHospRep."
sSql = sSql & "RegionManager INTO tblRepLookUp "
sSql = sSql & "FROM qryMDHospRep;"
dbs.Execute sSql

DoCmd.Hourglass False
MsgBox "Physician List Complete", vbInformation + vbOKOnly, "Process
Complete"

Set dbs = Nothing

Exit Sub

PROC_ERR:
MsgBox "The following error occured: " & Error$
Resume Next
End Sub
'==========================

Thanks in advance,

Henry

Lyle Fairfield
Guest
 
Posts: n/a
#8: Apr 30 '06

re: Delay of Hourglass


I never use DoCmd Hourglass being entirely satisfied 99.94% of the time
with the Access GUI straight from the box.
I see you've pasted this problem more than once so I'll chip in with my
!!!GUESS!!! which is that Access turns the Hourglass off automatically
after

sSql = "DROP TABLE tblRepLookUp"
dbs.Execute sSql

and that you might !!!TRY!!! moving
DoCmd.Hourglass True
DoEvents

to the line immediately following those.

In passing, I suppose you have considered that most accomplished
developers would not drop and create the tblRepLookUp but simply refer
directly to the query that you are using to populate it. One can assume
that the query executes slowly, as you are using the Hourglass; perhaps
this requires attention?

In addition, I recall in the olden days when Access and hardware were
much slower but I was quicker, I set the Status Bar on when running a
slow query; this gave an automatic progress bar at the bottom of the
screen tracking query execution progress.

Closed Thread