Public Function CountSpaces(strField As String) As Integer
    On Error Goto Err_CountSpaces
    Dim intCounter As Integer
    For intCounter = 1 To Len(strField)
        If Mid(strField, intCounter, 1) = " " Then
            CountSpaces = CountSpaces + 1
        End If
    Next intCounter
Exit_CountSpaces:
    Exit Function
Err_CountSpaces:
    CountSpaces = 0
    Resume Exit_CountSpaces    
End Function