Controlling Spell Checker

N

Neil

Is there way to have control over the MS-Access spell checking (besides just
launching it)? We want to tell it to check all records, but skip certain
fields (or, alternatively, ONLY check certain fields). Is that possible?

Alternatively, if that's not, we noticed that the spell checker skips fields
that are disabled. So one could disable the fields to be skipped; run the
spell checker; and then re-enable those fields when done. But how would one
know when it's done.

Any ideas/suggestions/hints/etc.?

Thanks,

Neil
 
G

Guest

Hi Neil,
Is there way to have control over the MS-Access spell checking (besides just
launching it)?
Yes.

We want to tell it to check all records, but skip certain
fields (or, alternatively, ONLY check certain fields). Is that possible?
Yes.

Alternatively, if that's not, we noticed that the spell checker skips fields
that are disabled. So one could disable the fields to be skipped; run the
spell checker; and then re-enable those fields when done. But how would one
know when it's done.

You don't need to go through these gymnastics. Here is an example for a
command button named cmdSpellCheck:

Private Sub cmdSpellCheck_Click()
On Error GoTo ProcError

Call SpellCheck(txtDescription)

ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, , _
"Error in cmdSpellCheck_Click event procedure..."
Resume ExitProc
End Sub


You can also call the function, for example, using the On Exit event
procedure for a textbox:

Private Sub txtRequestTitle_Exit(Cancel As Integer)
On Error GoTo ProcError

If Me.Dirty = True Then
SpellCheck ("txtRequestTitle")
End If

ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in txtRequestTitle_Exit event procedure..."
Resume ExitProc
End Sub


The SpellCheck function is added to a standard module, so that it can be
called from any form:

Option Compare Database
Option Explicit

Public Function SpellCheck(ctlSpell As Control)
On Error GoTo ProcError

' Debug.Print ctlSpell

Dim frm As Form
Set frm = Screen.ActiveForm
DoCmd.SetWarnings False

If Len(ctlSpell) > 0 Then
With ctlSpell
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
End With
DoCmd.RunCommand acCmdSpelling
End If

ExitProc:
DoCmd.SetWarnings True
Exit Function
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in SpellCheck Function..."
Resume ExitProc
End Function


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
N

Neil

Thanks, Tom. Looks like that would work great. Only thing is: our form is in
Continuous Forms view, and the goal is to spell check an entire set of
records after entering them. Do you know a way to spell check only a
particular field for multiple records?

Thanks!

Neil
 
N

Neil

I don't know. I offered that to the client, but he wants to be able to spell
check at the end. Don't ask me why. Maybe he feels it's too intrusive to
have the spell checker pop up each time? Don't know.
 
G

Guest

Hi Neil,

I'm sure you can set this up--I've just never tried doing so--by having code
that calls the SpellCheck function for the text boxes that you want to check.
This code would be within a loop that simulates the action of clicking on a
next button to access the next record. You would Do Until RS.EOF (recordset
EndOfFile). The form can be based on a query.

I don't like this solution for a couple of reasons:

1.) It's always possible for a user to later edit the data in one of the
text boxes, in a given record, entering a misspelled value. Since the data is
not checked "real time" (for instance, using the On Exit event procedure), a
misspelling will remain and can be printed on reports until the next time
that the function to check all records was run. You would need to check *ALL*
records every time to ensure that a user had not entered a misspelling.
Either that, or you'd need to timestamp all edits to records, and then run
this custom function on a recordset filtered with all records on or after the
last time it was run. That means that you'd have to store the last time the
custom function was run as well.

2.) Not likely to work too well in a multiuser environment, if other people
are editing records at the same time. So, your client would have to be A.) a
single user of your application, B.) be willing to kick other users out of
the database when they wanted to run their function (doesn't seem very
productive of other people's time to me) or C.) wait until after-hours, when
others had gone home, to run their custom function.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
N

Neil

Yeah, I'm not a big fan of moving through records on the form, even if I use
the recordsetclone object to guide it. I think I'll try to push the
real-time spell check option to the client. I think that's best.

Thanks,

Neil
 
A

Arvin Meyer [MVP]

The following code, when placed in a module can be called from a button on a
form. It will spell check only the text boxes on that form.

Public Function Spell()
' Arvin Meyer 9/17/1998
' Adapted from code by Terry Wickenden
Dim ctlSpell As Control
Dim frm As Form
Set frm = Screen.ActiveForm
DoCmd.SetWarnings False
' Enumerate Controls collection.
For Each ctlSpell In frm.Controls
If TypeOf ctlSpell Is TextBox Then
If Len(ctlSpell) > 0 Then
With ctlSpell
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
Next
DoCmd.SetWarnings True
End Function
 
N

Neil

Latest feedback: client agrees to have spell check come up after field is
edited; but only if it only comes up if there's a spelling error. Since it
comes up every time, whether there's a spelling mistake or not, he finds it
annoying. Any ideas?

Really, you'd think MS would give a little more control over the spell
checker. Or do you know of third-party spell checkers that might give more
control?

Thanks!

Neil
 
N

Neil

Thanks, Arvin. The problem I'm running into, though, is that the client
wants to check only a particular field, but for all records (in Continuous
Forms view) at once, not as each record is edited. I could change your code
below to use the control name for that one control, instead of the control
type. But the problem remains that it would still only check for that one
record.

I proposed to the client checking the spelling of that one field as it's
edited. He said that's fine, except that the spell checker comes up EVERY
time, even if there are no spelling mistakes. He doesn't like that.

So I'm left with two options: 1) find a way to run the spell checker for all
records in the form, but only for a particular field in each record; or 2)
find a way to have the spell checker pop up after that particular field is
edited, but only if there's a spelling error.

I guess there's a third option: find a third-party spell checker that
provides more programmatic control.

Thanks!

Neil
 
G

Guest

Hi Neil,
... but only if it only comes up if there's a spelling error. Since it
comes up every time, ...

I am NOT experiencing this symptom. For me, it comes up only if there is a
spelling error (or perhaps I should say it comes up only if a word is not
found in the database that is used to check for words). I just tried a quick
experiment, by changing a form to continuous view, but I'm still only getting
the spell checker to pop up when a word is misspelled.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
A

Arvin Meyer [MVP]

As far as I know, you can only spellcheck a single field in Datasheet view.
Continuous forms check all controls. At the conclusion of your data entry,
you could open a datasheet form with just the one field and run your
spellcheck. Seems like a kluge but when you have a client making an
unreasonable demand, sometimes a kluge is the only answer.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
N

Neil

When I run it (in Access 2003), it pops up "The spelling check is complete"
if there are no errors. You don't get that?
 
N

Neil

I'll mention that to him, maybe a "spell checker form."

But I wasn't even aware you can use the spell checker in datasheet view. It
does work in Continuous Forms view to check a single field by selecting the
field, as you note below. But, as noted, only for that single item that's
selected.

Neil
 
G

Guest

THANK YOU SO MUCH ---

this was a great POST!

Tom Wickerath said:
Hi Neil,


You don't need to go through these gymnastics. Here is an example for a
command button named cmdSpellCheck:

Private Sub cmdSpellCheck_Click()
On Error GoTo ProcError

Call SpellCheck(txtDescription)

ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, , _
"Error in cmdSpellCheck_Click event procedure..."
Resume ExitProc
End Sub


You can also call the function, for example, using the On Exit event
procedure for a textbox:

Private Sub txtRequestTitle_Exit(Cancel As Integer)
On Error GoTo ProcError

If Me.Dirty = True Then
SpellCheck ("txtRequestTitle")
End If

ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in txtRequestTitle_Exit event procedure..."
Resume ExitProc
End Sub


The SpellCheck function is added to a standard module, so that it can be
called from any form:

Option Compare Database
Option Explicit

Public Function SpellCheck(ctlSpell As Control)
On Error GoTo ProcError

' Debug.Print ctlSpell

Dim frm As Form
Set frm = Screen.ActiveForm
DoCmd.SetWarnings False

If Len(ctlSpell) > 0 Then
With ctlSpell
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
End With
DoCmd.RunCommand acCmdSpelling
End If

ExitProc:
DoCmd.SetWarnings True
Exit Function
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in SpellCheck Function..."
Resume ExitProc
End Function


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
G

Guest

Hi Neil,

Sorry about the late reply....I just now received a notification message
that there was a reply waiting for this thread (due to the post that Jeremy
Ellison just made). I did not receive a notification message when you posted
a reply on April 8th, but I noticed this message just now.

In answer to your question:
When I run it (in Access 2003), it pops up "The spelling check is complete"
if there are no errors. You don't get that?

I do not get any such pop up.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
N

Neil

Yeah, I had forgotten to put the SetWarnings False in there.........

BTW, how do you receive notifications of replies here?

Neil
 
D

Douglas J. Steele

You're using Outlook Express to connect to this newsgroup, so you don't have
the option of receiving notification of replies. That's only a feature in
the web interface Microsoft's created for the newsgroups. (and believe it,
it's not work switching to the web interface just to get that feature!)
 
A

Arvin Meyer [MVP]

All decent newsreaders have a feature that filters to only messages that we
write. In Outlook Express it is:

View >>> Current View >>> Show Replies to my Messages

Since we post frequently, we only need apply the filter and go through our
threads. Not only is it much faster that using a browser based reader, since
we've already downloaded all the existing messages, we can see the entire
thread at lightning speed, as well as every message in every thread that
we've participated in within a few seconds.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top