Automatic Spell Check in a Form

R

RossKK

How do I get Access to automatically spell check data entered into a specific
field in a form? I would like the spell check to run when the user attempts
to go to the next record.

Thank you!
 
J

Jeff Boyce

Just out of curiosity, why does it matter? That is, if the users are
getting 'creative' about their spelling, could you provide them with a list
of valid values and not allow them to make up their own?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
L

Linq Adams via AccessMonster.com

Normally this is done on exiting the given field, when the user has what they
meant to enter still fresh in their mind:

Private Sub ControlToBeChecked_Exit(Cancel As Integer)

With Me!ControlToBeChecked

If Len(.Value) > 0 Then
DoCmd.SetWarnings False
.SelStart = 1
.SelLength = Len(.Value)
DoCmd.RunCommand acCmdSpelling
.SelLength = 0
DoCmd.SetWarnings True
End If

End With

End Sub

But I suppose you can adapt the code for the Form_BeforeUpdate event.
 
A

Arvin Meyer [MVP]

RossKK said:
How do I get Access to automatically spell check data entered into a
specific
field in a form? I would like the spell check to run when the user
attempts
to go to the next record.

Put the following code in a Standard Module named basSpell:

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

Now call it in the form's BeforeUpdate event.
 

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