Ok, this is my first post, so please excuse any new user errors in posting.
I have a DB form that I’m attempting to run a spellchecker on for the entire form (current record only), but keep getting a run-time error 2424 upon its completion. I came across the follow code from another user that I'm using in a standard module:
Public Function SpellChecker()
Dim ctrl As Control
Dim frm As Form
Set frm = Screen.ActiveForm
DoCmd.SetWarnings False
For Each ctrl In frm.Controls
If TypeOf ctrl Is TextBox Then
If Len(ctrl) > 0 Then
With ctrl
.SetFocus
.SelStart = 0
.SelLength = Len(ctrl)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
Next
DoCmd.SetWarnings True
End Function
I then have a cmd button on the form to call the spellchecker:
Private Sub SpellChecker_Click()
Call SpellChecker
End Sub
The spellchecker works great, but after completing the function for the current records, it gives me the 2424 error. When debugging, it points to If Len(ctrl) >0 then as the problem.
Not quite sure what I'm doing wrong, but must admit that although I've been building DBs for a while, my coding skills are only average.
Any suggestions or corrections would be greatly appreciated.
Thanks