Can't restrict spell check to a single field

Mr Smin

Sometimes Excel too.
Local time
Today, 21:04
Joined
Jun 1, 2009
Messages
132
Hello. I have the following code which is intended to check the spelling in a Comments field. I can't understand why it also checks the Name field on the same form. I want to restrict it to the comments field because the Name field is locked in the form in question (and people's names often cause the spell check to offer alternatives!).

Code:
Private Sub txtComments_AfterUpdate()
    If Len(Me!txtComments & "") > 0 Then
        DoCmd.RunCommand acCmdSpelling
            Else
        Exit Sub
    End If
End Sub

Can anyone suggest a fix for this?

Thanks.
 
I think if you want it to search just that field the whole text needs to be highlighted and the textbox must have focus before running the spell checker. So:
Code:
Private Sub txtComments_AfterUpdate()
    If Len(Me!txtComments & "") <> 0 Then
        Me.txtComments.SelLength = Len(Me.txtComments)
        DoCmd.RunCommand acCmdSpelling
    Else
        Exit Sub
    End If
End Sub
 
That looks good - will try it later. Thanks.
 

Users who are viewing this thread

Back
Top Bottom