title: Access-VBA Non-Error Values Displaying as #Error
body: <p>I am attempting to handle errors caused by blank fields in an Access database. I have a function that takes the <code>Latitude</code> field's value, parses it to another format (from DMS to decimal), and is used in a query as a new field. As long as <code>Latitude</code> contains a valid DMS value, this works as expected. However, if it does not, the new field (<code>decLat</code>) will contain <code>#Error</code>.</p>
  
  <p>From my readings, this is typically caused by the value passed in being an Error itself. However, testing with IsError(doubLat) in the function itself shows that none of the outputs are Error.</p>
  
  <p>My next attempt was to check whether the output was 0 (because the conversion function is meant to return that in event of an error), but that doesn't seem to be the issue either. So the question is, what causes the code below to return <code>#Error</code> when the input is null?</p>
  
  <pre><code>Function LatToDecimal(latIn As Variant) As String 'latIn is Variant as attempt at error handling. Will always be String or Null.
      On Error GoTo ErrHandler
      If (latIn = "") Then
          GoTo ErrHandler
      ElseIf (IsNull(latIn)) Then GoTo ErrHandler
      End If
  Restart:
      Dim SplitA() As String
      SplitA() = Split(latIn, "°") 'A(0) is DEG.
      Dim SplitB() As String
      If (UBound(SplitA) &gt; 0) Then
          SplitB() = Split(SplitA(1), "'") 'B(0) is MIN.
      Else:
          LatToDecimal = "0"
          Exit Function
      End If
      Dim SplitC() As String
      If (UBound(SplitB) &gt; 0) Then
          SplitC() = Split(SplitB(1), """") 'C(0) is SEC. C(1) is N/S.
      Else:
          LatToDecimal = "0"
          Exit Function
      End If
      Dim deg As Double
      Dim min As Double
      Dim sec As Double
  
      deg = CDbl(SplitA(0)) 'Assign more readable names.
      min = CDbl(SplitB(0))
      sec = CDbl(SplitC(0))
  
      Dim minM As Double 'Transitional value.
      Dim decDeg As Double 'decimal degrees
  
      'Conversion to decimal
      minM = min + (sec / 60)
      decDeg = deg + (minM / 60)
      If (SplitC(1) = "S") Then decDec = decDeg * -1
  
      'Return value
      LatToDecimal = decDeg
      GoTo Finished
  
  ErrHandler:
      latIn = "0°0'0"""
      MsgBox ("Error!")
      GoTo Restart
  Finished:
  End Function
  
  'Wrapper to convert decimal latitude (from LatToDecimal) into Double values. Still need one for longitude.
  Function doubLat(ByVal latIn As String) As Double
      Dim newLat As Double
      newLat = CDbl(LatToDecimal(latIn))
      doubLat = newLat
      If (doubLat = 0) Then doubLat = 0#
  End Function
  </code></pre>
  
  <p>The function <code>doubLat</code> is the one called by my query.</p>