I'm trying to find the right combination to get the code to not error when I hit a record that doesn't have text within it.
Error 2427, You entered an expression that has no value.
I've commented out all of my failures below the with txt.
Error 2427, You entered an expression that has no value.
I've commented out all of my failures below the with txt.
Code:
Public Function SpellChecker(txt As TextBox) As Boolean
On Error GoTo Err_SpellChecker
With txt
'If IsBlank(.value) Then 'nope
'If Len(.value) = 0 Then 'nope
'If nz(.Value),0) = 0 Then 'doesn't recognize as a legitimate formula
'if len(.value & 0) = 0 then 'nope
'If IsNull(Len(.value & "")) Then
'If iserrror(Len(.value)) Then 'sub or function not defined error
GoTo Exit_SpellChecker
ElseIf Len(.value) > 0 Then
DoCmd.SetWarnings False
.SelStart = 1
.SelLength = Len(.value)
DoCmd.RunCommand acCmdSpelling
.SelLength = 0
DoCmd.SetWarnings True
End If
End With
Exit_SpellChecker:
DoCmd.SetWarnings True
Exit Function
Err_SpellChecker:
MsgBox "Error No.: " & Err.Number & vbNewLine & vbNewLine & _
"Description: " & Err.Description & vbNewLine & vbNewLine & _
"Function: SpellChecker" & vbNewLine & _
IIf(Erl, "Line No: " & Erl & vbNewLine, "") & _
"Module: basTest", , "Error: " & Err.Number
Resume Exit_SpellChecker
End Function