Run Spell Check In Access On One Field In A Form

If you want to automatically run the spell checker in an Access form, put this VBA code in the on exit event. It has to be in the on exit event, not the on change event, as you will get error messages if you put it in the on change event. Putting it in the on change event creates an endless loop, as the spell checker changing your spelling will then trigger the on change event again.

In this example, the field we are spell checking is called "comments".

VBA CODE:

With Me!Comments

.SetFocus

If Len(.Value) > 0 Then

.SelStart = 1

.SelLength = Len(.Value)

DoCmd.SetWarnings False

DoCmd.RunCommand acCmdSpelling

DoCmd.SetWarnings True

.SelLength = 0

End If

End With

NOTE: the docmd.setwarnings is there so that you don't get the "spell check complete" popup message box that normally would come up when the spell checker runs. That message is nice when the spell checker actually finds a misspelled word, but you normally would get that same message when the spell checker runs and doesn't find any errors. So in this case we preferred to supress it.