title: vba format function throws type mismatch error
body: <p>I am trying to format a number as currency in Access VBA.</p>
  
  <p>In the immediate window, when I enter:</p>
  
  <pre><code>? Format(123, "Currency")
  </code></pre>
  
  <p>I get the expected response: "$123.00"</p>
  
  <p>However, in the code window, when I enter:</p>
  
  <pre><code>Debug.Print Format(123, "Currency")
  </code></pre>
  
  <p>I get an error pointing to that line: "Run-time error '13': Type mismatch"</p>
  
  <p>Why does the same simple code work in the immediate window, but throw an error when run from the code window?</p>