Spell Check ONLY (1) Field. What is wrong with this code???

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Here is my code, and it works, except it continues to splell check other
fields as well, whch I dont want. Just for the current record and field.

Me.Job.SetFocus
RunCommand acCmdSpelling
 
Hi Dave

To spell check the current record and field use the following:

Private Sub cmdSpell_Click()
On Error Resume Next

Dim ctlSpell As Control

' Check the spelling in the selected text box
Set ctlSpell = Screen.PreviousControl
If TypeOf ctlSpell Is TextBox Then
If IsNull(Len(ctlSpell)) Or Len(ctlSpell) = 0 Then
MsgBox "There is nothing to spell check."
ctlSpell.SetFocus
Exit Sub
End If
With ctlSpell
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
End With
DoCmd.RunCommand acCmdSpelling
Else
MsgBox "Spell check is not available for this
item."
End If

ctlSpell.SetFocus

End Sub


Hope this helps

Maurice St-Cyr
Micro Systems Consultants, Inc
 
Will this work on a Memo Field?
I put the code on Double Click Event.
It does not seem to spell check after entering text into memo field, it just
says Spell Check is not Available for this item
 
Back
Top