SysCmd acSysCmdUpdateMeter: Gotchas?

P

PeteCresswell

Are there any common mistakes that people make when managing SysCmd's
meter?

I' m trapping out with a 7952 (illegal function call) partway through
a loop that increments the meter.

In the code below, it's dying on line 5412 when K = 107 - having
initialized the meter with X=118.

This has been an ongoing intermittant problem that's plagued me
thorughout this particular development effort - and that makes me
thing I'm doing something basically wrong in managing SysCmd's meter.

viz:
----------------------------------------------------------------------------------------------
5150 With securityRS
5159 If Not ((.BOF = True) And (.EOF = True)) Then
5160 If singleSecurityMode = False Then
5161 .MoveLast
5162 x = .RecordCount
5163 SysCmd acSysCmdInitMeter, "Bringing payment accruals up-
to-date as of " & theAsOfDate & " for " & Format$(x, "#,##0") & "
securities...", x
5164 .MoveFirst
5169 End If

5170 Do Until .EOF = True

..... (lotta stuff, but nothing that touches the meter or calls
SysCmd....)

5410 If singleSecurityMode = False Then
5411 k = k + 1
5412 SysCmd acSysCmdUpdateMeter, k
5419 End If

5490 .MoveNext
5499 Loop

5910 If singleSecurityMode = False Then
5911 SysCmd acSysCmdRemoveMeter
5919 End If

5990 End If
5991 End With
----------------------------------------------------------------------------------------------
 
P

PeteCresswell

If the illegal function call error occurs intermittently and for no apparent
reason, did something happen in Access immediately before the function call?
I'm just guessing but maybe Access updated the status bar behind the scenes,
temporarily removing the status meter, and your code tried to update the
meter on the next iteration through the loop. The status meter wasn't
visible at the time, causing an illegal function call. Just a guess.

Let's say that was the case.

Could the meter still be alive, but not visible?

If so, is there something I can feed to SysCmd that would make it
visible again, but not re-initialize it's values?
 
P

PeteCresswell

Let's say that was the case.
Could the meter still be alive, but not visible?

If so, is there something I can feed to SysCmd that would make it
visible again, but not re-initialize it's values?


It was Yours Truly. Under certain circumstances, I'm calling a
subroutine that creates an array and uses the status bar's meter for
that process.... stepping on the one already being used.


Which begs the question:
Is there some way to nest progress meters? I'd be happy if one became
temporarily invisible while the other took over... only to become
visible again...

Or are we now into one of those custom controls that shows a macro-bar
indicator and various sub-indicators concurrently?
 
T

Tony Toews [MVP]

IMO the built in meter is way too small. People, including me, just
don't see it.

Use some rectangle controls on a form. See the Progress Bars and
Microsoft Access page at
http://www.granite.ab.ca/access/progressbar.htm for more info.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
P

(PeteCresswell)

Per Chris O'C via AccessMonster.com:
What you could do
in your error handler whenever the 7952 error code occurs is to clear the
error first, then initialize the meter again with the original value of X,
then return to the line of code that caused the error and update the meter
with the value of K. Unless the PC is slow to update the screen, the user
won't notice the meter zig-zagging to zero and back to where it's supposed to
be.

I did that. Even with me (closet type A) watching the screen
intently, it doesn't seem to miss a beat.
 
Top