Spellcheck a field

R

RitchieJHicks

I added some code so that, on event end, the spell check was automatically
launched to check the text inpuuted in to the memo box. However, this
resulted in a bad loop where I kept getting confirmation that the spell check
was complete over and over again.

What is the recommended way to spell check a field? And what would the code
look like please?

Regards,
Ritchie.
 
A

Arvin Meyer [MVP]

Put the code below in a standard module. Put a button on your form and set
its Click event property to:

=Spell()

It will check every textbox on your 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
 
D

dsc2bjn

Arvin,
This works well for what was requested; however, I have a slightly
different situation.

I only wish to spell check a single text box on the form.

I am looking for a way have automatically check the spelling of a single
text box either through a button or automatically AfterUpdate.

Any suggestions would be greatly appreciated.
 
D

dsc2bjn

Thanks.

I found another method which works; however, any thing typed in all caps
automatically is considerd ok.

Do you know if this code has the same issue?
 
D

dsc2bjn

After I did a little more digging, I found out that it is an "Option" within
each of the Microsoft Office products. You can set a check box to either
check words in all caps or to ignore them. I guess they figure people
sometimes will be using a lot of acronyms and wish to bypass them all
together.

It is on the "Options>Spell Check" tab.

Thanks for the reply.
 

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

Top