Within the main form, I currently have the following code in place:
Code:
Public Function SpellChecker()
Dim ctrl As Control
Dim frm As Form
Set frm = Screen.ActiveForm
DoCmd.SetWarnings False
For Each ctrl In frm.Controls
If TypeOf ctrl Is TextBox Then
If Len(ctrl) > 0 Then
With ctrl
.SetFocus
.SelStart = 0
.SelLength = Len(ctrl)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
Next
DoCmd.SetWarnings True
End Function
Private Sub Spellcheck_Click()
Call SpellChecker
End Sub
I also added the same code in my other forms, which are "subform" controls in the Main form. However, after I tried entering stuff like Forms!MainFormName!SubFormControlName!Form - it gave me errors. I have to figure out a way to change the focus and have it spellcheck the actual subform -- but do I place the code in the main form VBA, or do I put the code in the actual forms. I'm thinking since I am working off of the main form, and it has the other forms as "subform controls" -- everything should technically be in the main form code since the subforms are controls.
I'm still not able to get it to work.. i'll keep trying - thanks for your help