J
John
Hi
How can I run spell check on a field on a form by the press of a button?
Many Thanks
Regards
How can I run spell check on a field on a form by the press of a button?
Many Thanks
Regards
Tom Wickerath said:Hi John,
How about something like this (two text box controls shown in this
example):
Private Sub cmdSpellCheck_Click()
On Error GoTo ProcError
SpellCheck ("txtRequestTitle")
SpellCheck ("txtRequestDescription")
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in cmdSpellCheck_Click event procedure..."
Resume ExitProc
End Sub
Add the following code to a new module, so that it can be called from any
form. Name the new module something like basUtilities (or anything except
the
name of this procedure [SpellCheck] or any other existing procedures in
your
database):
Private Sub SpellCheck(strControlName As String)
On Error GoTo ProcError
DoCmd.SetWarnings False
Dim ctl As Control
Set ctl = Controls(strControlName)
With ctl
If Len(.Text) > 0 Then
.SelStart = 0: .SelLength = Len(.Text)
DoCmd.RunCommand acCmdSpelling
End If
End With
ExitProc:
DoCmd.SetWarnings True
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in SpellCheck_Click procedure..."
Resume ExitProc
End Sub
Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
John said:Hi
How can I run spell check on a field on a form by the press of a button?
Many Thanks
Regards