testkitt2 . . .
I've already done some testing and [blue]
missinglinq's[/blue] proir post is correct! . . . (where to place the code?)
TheAceMan1 said:
[blue]The main problem is that events which could be used for automation (BeforeUpdate, AfterUpdate, OnExit, On LostFocus) are in conflict with the spellchecker as [purple]access wants to save while the spellchecker wants to edit! . . . [/purple]Hence errors are raised![/blue]
This eliminates these events and hence your direct automation.
If you don't mind semi-auto control the closet you can get is the [blue]DoubleClick[/blue] event of a [blue]textbox[/blue] to spellcheck the textbox and/or the [blue]DoubleClick[/blue] event of the [blue]form[/blue] to spellcheck a selected record (doubleclicking the record selector). If you decide to persue this method, perform the following:
[ol][li][blue]Backup then delete all previous code[/blue] you have relating to spellchecking . . . [purple]
Be sure you get it all![/purple] . . . [purple]
We can't afford any interaction here![/purple][/li]
[li]In a [blue]module[/blue] in the [blue]modules window[/blue], copy/paste the following:
Code:
[blue]Public Sub SpellCheck(Optional ctl)
Dim flg As Boolean
If IsMissing(ctl) Then
DoCmd.RunCommand acCmdSelectRecord
flg = True
ElseIf ctl.ControlType = acTextBox Then
If Trim(ctl & "") = "" Then
MsgBox "There is nothing to spell check for " & ctl.Name
Else
ctl.SelStart = 0
ctl.SelLength = Len(ctl)
flg = True
End If
Else
MsgBox "Spell check is not available for this item."
End If
If flg Then DoCmd.RunCommand acCmdSpelling
End Sub[/blue]
The routine will spellcheck the current record or textbox [blue]depending wether the textbox control is passed![/blue][/li]
[li]For any textbox in the form you desire to individually spellcheck, copy/paste the following to the [blue]DoubleClick[/blue] event of that textbox:
Code:
[blue] Call SpellCheck(Me![purple][b][i]TextboxName[/i][/b][/purple])[/blue]
[/li]
[li]Finally to cover [blue]selected record[/blue], in the forms [blue]DoubleClick[/blue] event, copy/paste the following:
Code:
[blue] Call SpellCheck[/blue]
[/li][/ol]
[blue]Special Note: Not only does this method work form any form, it works with subforms as well![/blue]
[blue]Your Thoughts? . . .[/blue]
See Ya! . . . . . .
Be sure to see FAQ219-2884: