SysCmd Method - can you do text and meter at the same time?

Hello - should you be able to use
     SysCmd acSysCmdUpdateMeter
and
     SysCmd acSysCmdSetStatus  
at the same time?

When I kept it to the Init and Update Meter, it worked fine, but when I tried to add the SetStatus into the mix, I get an "illegal function call" message.

Thanks
mlagrangeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Can you show the full code block you're using?

And explain to us the overall intent? I assume you want to both update the progress meter and display a message with SetStatus, but please be sure to clarify.
0
mlagrangeAuthor Commented:
Here's the code (I switched from looping through a table to looping through a counter):

Private Sub btnStatusBar_Click()

    On Error GoTo PROC_ERR

    Dim intRcds As Integer, intCntr As Integer, intPct As Integer
     
    intRcds = 10000
    SysCmd acSysCmdInitMeter, "Reading Data...", intRcds

    For intCntr = 1 To intRcds
        intCntr = intCntr + 1
       
        intPct = (intCntr / intRcds) * 100
       
        '-- I'm able to do one or the other, but not both
        SysCmd acSysCmdUpdateMeter, intCntr
        'SysCmd acSysCmdSetStatus, "Record " & intCntr & " of " & intRcds & "  (" & intPct & " % complete)"
       
    Next
   
    MsgBox "Finished"
    SysCmd acSysCmdRemoveMeter
   
PROC_EXIT:
    Exit Sub
 
PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT
   
End Sub

And yes, I'm just trying to get the Status text and the meter going at the same time.
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You should be able to, but perhaps you could do something like this instead:

Dim b As Boolean

    For intCntr = 1 To intRcds
        intCntr = intCntr + 1
       
        intPct = (intCntr / intRcds) * 100
       
        '-- I'm able to do one or the other, but not both
        If b Then
            SysCmd acSysCmdUpdateMeter, intCntr
        Else
            SysCmd acSysCmdSetStatus, "Record " & intCntr & " of " & intRcds & "  (" & intPct
& " % complete)"
         End If

  b = Not b

this would switch the calls between UpdateMeter and SetStatus, based on the value of the "b" Boolean variable
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

mlagrangeAuthor Commented:
By "should be able to", I assume you mean it's a Microsoft "you should, but you can't"  :-)

Ok, Thanks for the work-around. That will do fine.
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
By "should be able to", I assume you mean it's a Microsoft "you should, but you can't"  :-)
You got it! Glad that worked ...
0
mlagrangeAuthor Commented:
Well, foof - still getting the "You made an illegal function call". here's my low-tech solution:

Private Sub btnStatusBar_Click()

    On Error GoTo PROC_ERR

    Dim intRcds As Integer, intCntr As Integer, intPct As Integer
    Dim boo As Boolean, strMeter As String
     
    intRcds = 30000
    SysCmd acSysCmdInitMeter, "Reading Data...", intRcds
   
    For intCntr = 1 To intRcds
        intCntr = intCntr + 1
       
        intPct = (intCntr / intRcds) * 100
       
          strMeter = String(intPct / 10, Chr(124)) & String((100 - intPct) / 10, Chr(32))
            SysCmd acSysCmdSetStatus, strMeter & "   Record " & intCntr & " of " & intRcds & "  (" & intPct & " % complete)"
       
    Next
   
    MsgBox "Finished"
    SysCmd acSysCmdRemoveMeter
   
PROC_EXIT:
    Exit Sub
 
PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT
   
End Sub
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Which line?
0
mlagrangeAuthor Commented:
Sorry - don't have that version any more
I had it set up the way you did; when Boolean was true, it did the "...UpdateMeter"
else it did the "...SetStatus"
The first time through, Boolean was False (by default), and so it did the "...SetStatus", and negated the Boolean
On the 2nd time through, it got the error on the "...UpdateMeter"

I was surprised; it seemed like a reasonable enough work-around.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.