Spell check (1 Viewer)

Mr. SLP

Registered User.
Local time
Today, 12:45
Joined
Dec 23, 2017
Messages
56
this might be a little dumb but... is there anyway to have spell check auto run whenever focus changes between controls, without having to code it into each control? I got this code that works great and set it up on an OnExit event but wondering if there's a way to make it work for all items on a form.

Code:
Private Sub YOURFIELDNAME_Exit(Cancel As Integer) 
Dim strSpell
    strSpell = YOURFIELDNAME
    If IsNull(Len(strSpell)) Or Len(strSpell) = 0 Then
       Exit Sub
    End If
    With YOURFIELDNAME
        .SetFocus
        .SelStart = 0
        .SelLength = Len(strSpell)
    End With
    DoCmd.SetWarnings False
    DoCmd.RunCommand acCmdSpelling
    DoCmd.SetWarnings True
End Sub
 

nhorton79

Registered User.
Local time
Tomorrow, 05:45
Joined
Aug 17, 2015
Messages
147
Try looping through all text boxes on the form using:

For Each ctlVar In Me.Controls
If ctlVar.ControlType = acTextBox Then

<= Put your spell check code here

End If


I’m away from computer at the moment but something like like should be able to help you with a little tinkering..


Sent from my iPhone using Tapatalk
 

Users who are viewing this thread

Top Bottom