troubleshooting Question

Spell check entire tabbed form

Avatar of SteveL13
SteveL13Flag for United States of America asked on
Microsoft Access
12 Comments1 Solution86 ViewsLast Modified:
I'm trying to figure out how to use a command button onclick event to spell check an entire Access tabbed form.  Does anyone have a solution?

I have tried this code but it gives me an error that reads:

"Databasename can't move the focus to the control txtExpirationDate"  The field is set to TabStop = No but I tried TabStop = Yes also and got the same message.

Private Sub cmdSpellCheck_Click()

    Dim i As Integer
    'Turning off warnings to prevent completion message after each control
    ' is checked
    DoCmd.SetWarnings False
    'Loop through each control on the form
    For i = 0 To Me.Count - 1
    'Check to see if the control is a textbox
    If TypeOf Me(i) Is TextBox Then
    'Verify that focus is set to the control
    Me(i).SetFocus
    'Select starting point and select the contents of the control
    Me(i).SelStart = 0
    'Verify that the control contains data and select the contents
    If Len(Me(i)) > 0 Then
    Me(i).SelLength = Len(Me(i))
    'Run the Spell Checker on the contents of the control
    RunCommand acCmdSpelling
    End If
    End If
    Next i
    'Tell user that the check is complete for this record.
    MsgBox "Spell Check is Complete"
    'Turning warnings back on
    DoCmd.SetWarnings True

End Sub
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros