Spell Check Current Record



Hi All,

I have a form that has a spell check button with the following code:
Private Sub Spell_Check_Click()
DoCmd.RunCommand acCmdSpelling
End Sub

The problem with the button is it checks all records in my queue with most
of the time the queue will have more than one record but not more than 3 or
4. Is these a way to only spell check the current record upon click? The
only fields that would need spell checking are named Audit_nme, AuditDesc,
and Notes3. Any ideas on how i can make the button Spell_Check work as i am
describing? Thanks.

Arvin Meyer MVP

The following code, when called from a standard module, will only check the
textboxes in the current record:

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
.SelStart = 0
.SelLength = Len(ctlSpell)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
DoCmd.SetWarnings True
End Function

Arvin Meyer MVP

Linq Adams via AccessMonster.com said:
Nice hack, Arvin! I had created one for one-record/one-field, for a
but not for one-record/all-fields! I've archived this and will post it, as
required, with the authorship notice intact, of course!

Notice the date. This code is almost 10 years old. Previous to my changes,
Terry Wickenden (of Access RunCommand fame) posted the original code in
comp.databases.ms-access, and I adapted it to run anywhere from a standard

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