title: How to show progress on status bar when running code (not queries)
body: <p>I have already posted a question about updating the status bar while running queries in MS Access 2010. Please see <a href="https://stackoverflow.com/questions/27765376/how-to-show-progress-on-status-bar-when-running-a-sequence-of-queries-in-ms-acce">How to show progress on status bar when running a sequence of queries in MS Access</a> if you are interested.</p>
  
  <p>This is a very simple question about some code that doesn't work. I hope that if someone can answer it, it may help my understanding of why the code for the more complicated question doesn't work.</p>
  
  <pre><code>Function PutMessageInStatusBar1()
  
  Dim RetVal As Variant
  Dim i As Long
  
  RetVal = SysCmd(4, "Before loop 1")
  For i = 1 To 500000000
  Next
  
  RetVal = SysCmd(4, "Before loop 2")
  For i = 1 To 500000000
  Next
  
  RetVal = SysCmd(4, "Before loop 3")
  For i = 1 To 500000000
  Next
  RetVal = SysCmd(5)
  
  End Function
  </code></pre>
  
  <p>I wrote a macro to run the code. It starts by turning warnings off, then calls the above function, displays a message box to say "Finished" and then turns warnings on.</p>
  
  <p>When I run it, the status bar first shows "Ready". There is a pause, presumably while the code is running Loop 1. Then it shows "Before loop 2" and finally "Before loop 3".</p>
  
  <p>Why doesn't it display "Before loop 1"?</p>
  
  <p>I tried putting RetVal = syscmd(5) right at the beginning of the function to see if it made any difference. It didn't.</p>