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:
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
'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
'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
'Tell user that the check is complete for this record.
MsgBox "Spell Check is Complete"
'Turning warnings back on