Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit Spell Check to work only on a specified field. 1

Status
Not open for further replies.

LD1010

Technical User
Dec 6, 2001
78
US
Thanks for taking the time to read my post.
A user asked me to provide her with spell check on a specific field in a form. The name of the control is StatusNotes. So on the AfterUpdate event of that control I used the following code:

Private Sub StatusNotes_AfterUpdate()
On Error Resume Next

If Len(Me!StatusNotes & "") > 0 Then
DoCmd.RunCommand acCmdSpelling
Else
Exit Sub
End If

End Sub

The spell check works as expected but if it finds a misspelled word, and you click either the "Change" or "Ignore" options and it's the last misspelled word in that field it then cycles to the next record and finds any misspelled word in whatever field of that record. Can someone help to limit the spell check to work only on the specified field and not cycle to the next record?
Thanks

 
This uses a Command Button, but you should be able to use it in the OnExit event of a Control, as well:
Code:
Private Sub LimitedSpellCheckButton_Click()

With Me!ControlToBeChecked
  
  Me!ControlToBeChecked.SetFocus
    
  If Len(.Value) > 0 Then
    DoCmd.SetWarnings False
    .SelStart = 1
    .SelLength = Len(.Value)
    DoCmd.RunCommand acCmdSpelling
     .SelLength = 0
    DoCmd.SetWarnings True
  End If

End With

End Sub

The Missinglinq

Richmond, Virginia

The Devil's in the Details!
 
Thanks for your help Missinglinq! Just what I needed. Sorry I didn't respond earlier I had to leave to deal with a family member's health issue.
 
Glad we could help!

May your family member have a speedy recovery.

Hope this helps!

There's always more than one way to skin a cat!

All posts/responses based on Access 2003/2007
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top