How to show progress on status bar when running code (not queries)

前端 未结 1 1132
夕颜
夕颜 2021-01-24 08:35

I have already posted a question about updating the status bar while running queries in MS Access 2010. Please see How to show progress on status bar when running a sequence of

相关标签:
1条回答
  • 2021-01-24 09:12

    Call DoEvents after each SysCmd call. That will signal Windows to update the display before your code advances.

    In this function, each status bar message is visible before the next is displayed.

    Function PutMessageInStatusBar2()
        Const lngMilliseconds As Long = 1000
    
        SysCmd acSysCmdSetStatus, "Before loop 1"
        DoEvents
        Sleep lngMilliseconds
        SysCmd acSysCmdSetStatus, "Before loop 2"
        DoEvents
        Sleep lngMilliseconds
        SysCmd acSysCmdSetStatus, "Before loop 3"
        DoEvents
        Sleep lngMilliseconds
        SysCmd acSysCmdSetStatus, "Done."
        DoEvents
        Sleep lngMilliseconds
    
        SysCmd acSysCmdClearStatus
    
    End Function
    

    Sleep is based on a Windows API method and is declared in the Declarations section of a standard module:

    Option Compare Database
    Option Explicit
    Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    
    0 讨论(0)
提交回复
热议问题