title: function return 0 value in Ms Access
body: <p>I created a function in Ms Access and called it to the sub procedure in the form, but it returns 0.
  This is the code in the function:</p>
  
  <pre><code>Public Function Sum(a, b) As Double
      Dim total
      total = a + b
  End Function
  </code></pre>
  
  <p>The code in the sub procedure in the form is:</p>
  
  <pre><code>Private Sub cmdDisplay_Click()
      Dim a As Double
      Dim b As Double
  
      a = Val(Text0)
      b = Val(Text2)
  
      MsgBox (Sum(a, b))
  End Sub
  </code></pre>
  
  <p>it displays 0 in every time I tested the button which it should have been added a and b together. Please help</p>