By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 765 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Controlled use of Access spell check possible?

P: n/a
There's this app I wrote a long time ago for a client who uses it to
administer the database content that drives their Web site. Last time I was
in there' I notices a lot of embarassing typos in the data, and since this
data is published on their Web site which is their primary interface to their
customers, that's a bad thing.

I was thinking it would be nice if I could automatically spell check certain
fields, and somehow use the Access spell checker to do it. The problem is,
the only way I can find to run the spell checker is with the DoCmd.RunCommand
.... This command takes no arguments, and does exactly one thing - checks the
spelling of the current control, and reports the results to the user.

There's no way to make the spell check window not display if there are no
errors, and there's no way to programmatically know whether the spell check
had a problem or not.

Does anyone know how to get more control over the spell check process in
Access?
Nov 13 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
See whether the following helps:

Function SpellCheck_WordLB(WordToCheck As String) As Boolean
On Error GoTo Err_SpellCheck_WordLB

Dim wd As Object

If Len(WordToCheck) > 0 Then
Set wd = CreateObject("Word.Application")
SpellCheck_WordLB = wd.CheckSpelling(WordToCheck)
Else
MsgBox "You have to give me a word!"
End If

End_SpellCheck_WordLB:
If Not wd Is Nothing Then
wd.Quit
Set wd = Nothing
End If
Exit Function

Err_SpellCheck_WordLB:
MsgBox Err.Description & " (" & Err.Number & ")"
Resume End_SpellCheck_WordLB

End Function
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:c1********************************@4ax.com...
There's this app I wrote a long time ago for a client who uses it to
administer the database content that drives their Web site. Last time I was in there' I notices a lot of embarassing typos in the data, and since this
data is published on their Web site which is their primary interface to their customers, that's a bad thing.

I was thinking it would be nice if I could automatically spell check certain fields, and somehow use the Access spell checker to do it. The problem is, the only way I can find to run the spell checker is with the DoCmd.RunCommand ... This command takes no arguments, and does exactly one thing - checks the spelling of the current control, and reports the results to the user.

There's no way to make the spell check window not display if there are no
errors, and there's no way to programmatically know whether the spell check had a problem or not.

Does anyone know how to get more control over the spell check process in
Access?

Nov 13 '05 #2

P: n/a
Well, since all the users have MS Word installed, that should work, but it
seems pretty kludgey to have to start a whole instance of MS Word to check
spelling when Access already has the capability buried somewhere. That's
especially an issue since the users are running Office 2000 on Windows 98, and
are prone to Out of Memory errors.

On Wed, 29 Sep 2004 18:06:43 -0400, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
See whether the following helps:

Function SpellCheck_WordLB(WordToCheck As String) As Boolean
On Error GoTo Err_SpellCheck_WordLB

Dim wd As Object

If Len(WordToCheck) > 0 Then
Set wd = CreateObject("Word.Application")
SpellCheck_WordLB = wd.CheckSpelling(WordToCheck)
Else
MsgBox "You have to give me a word!"
End If

End_SpellCheck_WordLB:
If Not wd Is Nothing Then
wd.Quit
Set wd = Nothing
End If
Exit Function

Err_SpellCheck_WordLB:
MsgBox Err.Description & " (" & Err.Number & ")"
Resume End_SpellCheck_WordLB

End Function


Nov 13 '05 #3

P: n/a
On Sep 29 2004, 01:48 pm, Steve Jorgensen <no****@nospam.nospam> wrote
in news:c1********************************@4ax.com:

<snip>

I was thinking it would be nice if I could automatically spell check
certain fields, and somehow use the Access spell checker to do it.
The problem is, the only way I can find to run the spell checker is
with the DoCmd.RunCommand ... This command takes no arguments, and
does exactly one thing - checks the spelling of the current control,
and reports the results to the user.

There's no way to make the spell check window not display if there are
no errors, and there's no way to programmatically know whether the
spell check had a problem or not.


Well, this is probably even a bigger kludge than using Word, but the
windows that are displayed when spell check doesn't find any errors and
when it does are quite distinct (in the former case the caption is the
app's title, in the latter it is "Spelling", and in both cases the windows
are owned by the main Access window), so you should be able to use Win32
APIs to distinguish between these two cases.

Not that I'm really suggesting that, but since you asked... ;)

--
remove a 9 to reply by email
Nov 13 '05 #4

P: n/a
I have the following code in a module
' ************************************************** ***************
' Got this spell checker from the Google new group and
' with some help from a contributer named Salad
' Call this from the "Lost Focus" event of a text box
Public Function SpellChecker(Calling As Form)

Dim ctlSpell As Control
Dim Incoming As String, Outgoing As String

DoCmd.SetWarnings False
Set ctlSpell = Calling.ActiveControl
If (ctlSpell.Locked) Then
Line1 = "Cannot spell check. Field is read-only"
mbResult = MessageBox("OK", "", "", Line1)
Else
If Len(ctlSpell) > 0 Then
Incoming = ctlSpell
With ctlSpell
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
End With
DoCmd.RunCommand acCmdSpelling
Outgoing = ctlSpell
End If
' See if any changes were made 09/29/04
If (Incoming <> Outgoing) Then
' Notify user that changes
' were made, if you want to,
' or give Bronx cheer
End If
End If

End Function

From any text box on any form call the funtion
' ************************************************** *****
' Automatically spell check this control 09/27/04
Private Sub GeneralMessage_LostFocus()

SpellChecker Me

End Sub

Hank Reed
Nov 13 '05 #5

P: n/a
Neat - that looks like a good starting point.

On 30 Sep 2004 02:37:34 -0700, ha********@aol.com (Hank Reed) wrote:
I have the following code in a module
' ************************************************** ***************
' Got this spell checker from the Google new group and
' with some help from a contributer named Salad
' Call this from the "Lost Focus" event of a text box
Public Function SpellChecker(Calling As Form)

Dim ctlSpell As Control
Dim Incoming As String, Outgoing As String

DoCmd.SetWarnings False
Set ctlSpell = Calling.ActiveControl
If (ctlSpell.Locked) Then
Line1 = "Cannot spell check. Field is read-only"
mbResult = MessageBox("OK", "", "", Line1)
Else
If Len(ctlSpell) > 0 Then
Incoming = ctlSpell
With ctlSpell
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
End With
DoCmd.RunCommand acCmdSpelling
Outgoing = ctlSpell
End If
' See if any changes were made 09/29/04
If (Incoming <> Outgoing) Then
' Notify user that changes
' were made, if you want to,
' or give Bronx cheer
End If
End If

End Function

From any text box on any form call the funtion
' ************************************************** *****
' Automatically spell check this control 09/27/04
Private Sub GeneralMessage_LostFocus()

SpellChecker Me

End Sub

Hank Reed


Nov 13 '05 #6

P: n/a
On Wed, 29 Sep 2004 22:30:34 GMT, Steve Jorgensen
<no****@nospam.nospam> wrote:
Well, since all the users have MS Word installed, that should work, but it
seems pretty kludgey to have to start a whole instance of MS Word to check
spelling when Access already has the capability buried somewhere. That's
especially an issue since the users are running Office 2000 on Windows 98, and
are prone to Out of Memory errors.
When I run across a user who is S T I L L using Win98, I simply tell
them to upgrade or they get no more support. Presto -- problem
solved. I all but RARE occasions, they upgrade right away. For the
ones who don't -- well it's a blessing in disguise!


On Wed, 29 Sep 2004 18:06:43 -0400, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
See whether the following helps:

Function SpellCheck_WordLB(WordToCheck As String) As Boolean
On Error GoTo Err_SpellCheck_WordLB

Dim wd As Object

If Len(WordToCheck) > 0 Then
Set wd = CreateObject("Word.Application")
SpellCheck_WordLB = wd.CheckSpelling(WordToCheck)
Else
MsgBox "You have to give me a word!"
End If

End_SpellCheck_WordLB:
If Not wd Is Nothing Then
wd.Quit
Set wd = Nothing
End If
Exit Function

Err_SpellCheck_WordLB:
MsgBox Err.Description & " (" & Err.Number & ")"
Resume End_SpellCheck_WordLB

End Function


Nov 13 '05 #7

P: n/a
I know what you're saying, but this company has 100s of Windows 98 machines
and their own IT staff with their own opinions. Not much I can do about it.

On Sat, 02 Oct 2004 03:29:35 -0500, Lauren Wilson <???@???.???> wrote:
On Wed, 29 Sep 2004 22:30:34 GMT, Steve Jorgensen
<no****@nospam.nospam> wrote:
Well, since all the users have MS Word installed, that should work, but it
seems pretty kludgey to have to start a whole instance of MS Word to check
spelling when Access already has the capability buried somewhere. That's
especially an issue since the users are running Office 2000 on Windows 98, and
are prone to Out of Memory errors.


When I run across a user who is S T I L L using Win98, I simply tell
them to upgrade or they get no more support. Presto -- problem
solved. I all but RARE occasions, they upgrade right away. For the
ones who don't -- well it's a blessing in disguise!


On Wed, 29 Sep 2004 18:06:43 -0400, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
See whether the following helps:

Function SpellCheck_WordLB(WordToCheck As String) As Boolean
On Error GoTo Err_SpellCheck_WordLB

Dim wd As Object

If Len(WordToCheck) > 0 Then
Set wd = CreateObject("Word.Application")
SpellCheck_WordLB = wd.CheckSpelling(WordToCheck)
Else
MsgBox "You have to give me a word!"
End If

End_SpellCheck_WordLB:
If Not wd Is Nothing Then
wd.Quit
Set wd = Nothing
End If
Exit Function

Err_SpellCheck_WordLB:
MsgBox Err.Description & " (" & Err.Number & ")"
Resume End_SpellCheck_WordLB

End Function


Nov 13 '05 #8

P: n/a
On Sat, 02 Oct 2004 03:29:35 -0500, Lauren Wilson <???@???.???> wrote:
When I run across a user who is S T I L L using Win98, I simply tell
them to upgrade or they get no more support. Presto -- problem
solved. I all but RARE occasions, they upgrade right away. For the
ones who don't -- well it's a blessing in disguise!

Hi
You're right of course but we get most of our business from companies
whose IT departments treat them like this!
David

Nov 13 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.