Show status bar message for at least a couple of seconds?

S

StargateFan

Good Morning and awake enough to remember it's the new year <g> and to
wish everyone a Happy New Year! :blush:D

I've pieced this together from various messages in the archives. It
seems to work just great. However, when I found and added code for
the status bar, had a feeling it would wink on and off - which it did.
At least, I'm assuming the flicker in the status bar was my message!
<g>

Any way to have the simple status bar message below display for a
couple of seconds before being destroyed, by any chance? Here is the
code as it stands now:

*****************************************************************************
Private Sub RequeryContactsForm_Click()

varReturn = SysCmd(acSysCmdInitMeter, "Re-querying ...", 1) 'msg to
user in status bar

On Error GoTo Err_RequeryContacts_Click

Me.Requery
varReturn = SysCmd(acSysCmdClearStatus) 'clears
status bar msg

Exit_RequeryContactsForm_Click:
Exit Sub

Err_RequeryContacts_Click:
MsgBox Err.Description
Resume Exit_RequeryContactsForm_Click

End Sub
*****************************************************************************

Thanks! :blush:D
 
K

Ken Snell \(MVP\)

Add a loop for doing DoEvents to "idle" the PC for a short time.

varReturn = SysCmd(acSysCmdInitMeter, "Re-querying ...", 1) 'msg to
user in status bar

On Error GoTo Err_RequeryContacts_Click

Me.Requery
Dim lngLoop As Long
For lngLoop = 1 To 100
DoEvents
Next lngLoop
varReturn = SysCmd(acSysCmdClearStatus) 'clears
status bar msg
 
S

StargateFan

Add a loop for doing DoEvents to "idle" the PC for a short time.

varReturn = SysCmd(acSysCmdInitMeter, "Re-querying ...", 1) 'msg to
user in status bar

On Error GoTo Err_RequeryContacts_Click

Me.Requery
Dim lngLoop As Long
For lngLoop = 1 To 100
DoEvents
Next lngLoop
varReturn = SysCmd(acSysCmdClearStatus) 'clears
status bar msg

Well, I saw the text for a fraction of a second this time <lol>. I
found that I did not like the progress meter thingie at all. Only one
box gets filled up out of the entire bar and it then disappears too
quickly. Confusing for the user I think. I went back to the archives
and hunted down the code I'd seen earlier this morning that I couldn't
figure out how to destroy at the end of the script. This time, after
playing and playing and guessing, this is what I came up with (it
seems to work and the text disappears after a couple of seconds
<fingers crossed>:

************************************************
Private Sub RequeryContactsForm_Click()

varReturn = SysCmd(acSysCmdSetStatus, "Re-querying ...") 'msg to user
in status bar

On Error GoTo Err_RequeryContacts_Click

Me.Requery
Dim lngLoop As Long
For lngLoop = 1 To 1000
DoEvents
Next lngLoop
varReturn = SysCmd(acSysCmdClearStatus) 'clears
status bar msg

Exit_RequeryContactsForm_Click:
Exit Sub

Err_RequeryContacts_Click:
MsgBox Err.Description
Resume Exit_RequeryContactsForm_Click

End Sub
************************************************

I'll have to keep my eye on that 1000, though. It seems to give me a
2-second display but my, albeit limited, experience with scripting
says that this might be too high a number in certain situations. As I
said, I'll monitor. I look at the statuts bar a lot in many apps just
out of habit, so it's handy for me. (But 1000 means 10 seconds in
other scripting apps.) Anyway, we'll see how this works out.

Thanks bunches!! :blush:D
 
Top