Spell Check

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I use spell check in a form for a particular text box, it continues on to the next record. I only want it to check the text box that has focus. Is there a macro or something I can use to have it stay in the text box.
 
I got this fro a posting by John Spencer

http://groups.google.co.uk/groups?q...s.*&[email protected]&rnum=1

Try the following code. Paste it into a module. It is
designed to check
controls on a single form. I have not checked it on a
continous form, but I
would expect it to work there also.

Public Function fSpell()
'*******************************************
'Name: fSpell (Function)
'Purpose: Spell check current field or fields.
'Author: John Spencer UMBC-CHPDM
'Date: October 31, 2002, 01:15:31 PM
'Control on form must be a textbox and have tag property
'that contains the phrase "SpellCheck"
'*******************************************

Dim ctlSpell As Control
Dim frm As Form

On Error GoTo fSpell_Error

Set frm = Screen.ActiveForm

Set ctlSpell = frm.ActiveControl
With ctlSpell
If TypeOf ctlSpell Is TextBox Then
If InStr(1, Nz(.Tag), "SpellCheck",
vbTextCompare) <> 0 And _
.Locked = False And _
.Enabled = True And _
Len(Trim(ctlSpell.Text & vbNullString)) > 0 Then

.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell.Text)

docmd.RunCommand acCmdSpelling
End If
End If
End With

Exit Function

Jim
-----Original Message-----
When I use spell check in a form for a particular text
box, it continues on to the next record. I only want it to
check the text box that has focus. Is there a macro or
something I can use to have it stay in the text box.
 
Back
Top