Spell Check VIA Code

iank

Registered User.
Local time
Today, 22:22
Joined
Jan 20, 2004
Messages
25
I was wondering if there was a way to perform a spell check on a particular field each time ive finished entering a record on a form?
 
From previous requests, it doesn't appear there is a simple method.

I don't know how to give you a link to another thread but if you do a search on "acCmdSpelling" it will bring up some discussions and options on this.

Good luck.. Peter
 
Yeah, it's just a case of putting:

Code:
DoCmd.RunCommand acCmdSpelling

where you want it (i.e. BeforeUpdate event of your form)
 
iank said:
I was wondering if there was a way to perform a spell check on a particular field each time ive finished entering a record on a form?
No! the built in spell checker will spell check the whole form, and since it will force a save in doing so you need to be careful where and how you use it.
 
This will allow you to select a specific field for the current record and check the spelling against the selected text string...
Code:
Me.TextBox1.SetFocus
Me.TextBox1.SelStart = Me!TextBox1.SelStart
Me.TextBox1.SelLength = Len([TextBox1])

DoCmd.RunCommand acCmdSpelling
 
Solution

incase anyone is interested i got it working
it will check just 1 field each time it gets edited..

--
-this is in the globals for the form

Dim boolSpellCheck As Boolean ' do we need to spell check?
--

-now the main part

Private Sub txtDocument_Title_BeforeUpdate(Cancel As Integer)
boolSpellCheck = True ' the value has been edited and will need to be spell checked
End Sub

Private Sub txtDocument_Title_Exit(Cancel As Integer)
If (Len(txtDocument_Title.Value) > 0) And (boolSpellCheck = True) Then
With txtDocument_Title
.SetFocus
.SelStart = 0
.SelLength = Len(.Value)
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSpelling ' perform spell check
DoCmd.SetWarnings True
boolSpellCheck = False
txtDocument_EndID.SetFocus
End With
End If
End Sub

hope this helps someone else
 
What area is "Globals for the Form"?

incase anyone is interested i got it working
it will check just 1 field each time it gets edited..

--
-this is in the globals for the form

Dim boolSpellCheck As Boolean ' do we need to spell check?
--

-now the main part

Private Sub txtDocument_Title_BeforeUpdate(Cancel As Integer)
boolSpellCheck = True ' the value has been edited and will need to be spell checked
End Sub

Private Sub txtDocument_Title_Exit(Cancel As Integer)
If (Len(txtDocument_Title.Value) > 0) And (boolSpellCheck = True) Then
With txtDocument_Title
.SetFocus
.SelStart = 0
.SelLength = Len(.Value)
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSpelling ' perform spell check
DoCmd.SetWarnings True
boolSpellCheck = False
txtDocument_EndID.SetFocus
End With
End If
End Sub

hope this helps someone else


Hello, Im not familiar with globals for the form, where exactly is that in code/form?

Thanx for your response...

JK
 

Users who are viewing this thread

Back
Top Bottom