spell checker

K

kevcar40

Hi
i have the following code to check the spelling ot text entered into a
text box
it works fine
however a message box appears saying Spelling check complete if there
is no spelling error


If Len(Me!Reason & "") > 0 Then
DoCmd.RunCommand acCmdSpelling
Else
Exit Sub
End If

Is it possible to stop this message appearing if there is no spelling
mistake


thanks

kevin
 
M

[MVP]

Hi
i have the following code to check the spelling ot text entered into a
text box
it works fine
however a message box appears saying Spelling check complete if there
is no spelling error

If Len(Me!Reason & "") > 0 Then
        DoCmd.RunCommand acCmdSpelling
            Else
        Exit Sub
End If

Is it possible to stop this message appearing if there is no spelling
mistake

thanks

kevin

Hi,

Private Sub Text_AfterUpdate()
'Call CheckSpelling(Me)
If Len(Me!text & "") > 0 Then
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSpelling
DoCmd.SetWarnings True
Else
Exit Sub
End If
End Sub

However, this will spell-check all the fields/records. Better approach
is to use the following code - add tag property "SpellCheck" for field
(s) for which you want to run spell check:

Private Sub Text_AfterUpdate()
Call CheckSpelling(Me)
End Sub

Function CheckSpelling(ByRef frmFormName As Form)
Dim ctlControlName As Control
DoCmd.SetWarnings False
For Each ctlControlName In frmFormName
Select Case ctlControlName.ControlType
Case acTextBox
If Nz(ctlControlName, "") <> "" Then
If ctlControlName.Tag = "SpellCheck" Then
With ctlControlName
..SetFocus
..SelStart = 0
..SelLength = Len(ctlControlName)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
End Select
Next ctlControlName
DoCmd.SetWarnings True
End Function

Add spaces/tabs to code to have it readable.

Regards,
Branislav Mihaljev
Microsoft Access MVP
 
K

kevcar40

Hi,

Private Sub Text_AfterUpdate()
    'Call CheckSpelling(Me)
    If Len(Me!text & "") > 0 Then
        DoCmd.SetWarnings False
        DoCmd.RunCommand acCmdSpelling
        DoCmd.SetWarnings True
    Else
        Exit Sub
    End If
End Sub

However, this will spell-check all the fields/records. Better approach
is to use the following code - add tag property "SpellCheck" for field
(s) for which you want to run spell check:

Private Sub Text_AfterUpdate()
Call CheckSpelling(Me)
End Sub

Function CheckSpelling(ByRef frmFormName As Form)
Dim ctlControlName As Control
DoCmd.SetWarnings False
For Each ctlControlName In frmFormName
Select Case ctlControlName.ControlType
Case acTextBox
If Nz(ctlControlName, "") <> "" Then
If ctlControlName.Tag = "SpellCheck" Then
With ctlControlName
.SetFocus
.SelStart = 0
.SelLength = Len(ctlControlName)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
End Select
Next ctlControlName
DoCmd.SetWarnings True
End Function

Add spaces/tabs to code to have it readable.

Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -

- Show quoted text -

thank you
i will try now
 
K

kevcar40

Hi,

Private Sub Text_AfterUpdate()
    'Call CheckSpelling(Me)
    If Len(Me!text & "") > 0 Then
        DoCmd.SetWarnings False
        DoCmd.RunCommand acCmdSpelling
        DoCmd.SetWarnings True
    Else
        Exit Sub
    End If
End Sub

However, this will spell-check all the fields/records. Better approach
is to use the following code - add tag property "SpellCheck" for field
(s) for which you want to run spell check:

Private Sub Text_AfterUpdate()
Call CheckSpelling(Me)
End Sub

Function CheckSpelling(ByRef frmFormName As Form)
Dim ctlControlName As Control
DoCmd.SetWarnings False
For Each ctlControlName In frmFormName
Select Case ctlControlName.ControlType
Case acTextBox
If Nz(ctlControlName, "") <> "" Then
If ctlControlName.Tag = "SpellCheck" Then
With ctlControlName
.SetFocus
.SelStart = 0
.SelLength = Len(ctlControlName)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
End Select
Next ctlControlName
DoCmd.SetWarnings True
End Function

Add spaces/tabs to code to have it readable.

Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -

- Show quoted text -

ok trying it now
can you give me a little clarification please
my form is called inhibitors
the text box to check is called reason
Do i need to change "ByRef frmFormName As Form" to "ByRef
inhibitors As Form
and all occurrances of frmFormname

and do i need to change ctlcontrolName to Me.reason

thanks again

kevin
 
M

[MVP]

ok trying it now
 can you give me a little clarification please
my form is called inhibitors
the text box to check is called reason
Do i need to change    "ByRef frmFormName As Form" to  "ByRef
inhibitors As Form
and all occurrances of frmFormname

and do i need to change ctlcontrolName to Me.reason

thanks again

kevin

Hi,

Open form in Design View, select field(s) for which you want to run
Spell Check, open Properties window and find in the list property
"Tag". Write there "SpellCheck" (without quotes).

In your case select field "reason", find in Property window event
AfterUpdate, select [Event Procedure] and click "...". Code should
look like this:

Private Sub reason_AfterUpdate()
Call CheckSpelling(Me)
End Sub

Add new module, copy above function (Function CheckSpelling) and save
it by name "modSpellCheck". While you are there - in VBA window, click
menu Debug > Compile to make sure there are no errors in code.

Run form, try to enter text in field "reason" both without and with
spell errors. It should pop-up spell checker when there is an error
only, without message "Spell Check completed".

Above approach will run Spell Check for particular field only and for
the one record only - the one which got new value.

Regards,
Branislav Mihaljev
Microsoft Access MVP
 
K

kevcar40

ok trying it now
 can you give me a little clarification please
my form is called inhibitors
the text box to check is called reason
Do i need to change    "ByRef frmFormName As Form" to  "ByRef
inhibitors As Form
and all occurrances of frmFormname
and do i need to change ctlcontrolName to Me.reason
thanks again

Hi,

Open form in Design View, select field(s) for which you want to run
Spell Check, open Properties window and find in the list property
"Tag". Write there "SpellCheck" (without quotes).

In your case select field "reason", find in Property window event
AfterUpdate, select [Event Procedure] and click "...". Code should
look like this:

Private Sub reason_AfterUpdate()
  Call CheckSpelling(Me)
End Sub

Add new module, copy above function (Function CheckSpelling) and save
it by name "modSpellCheck". While you are there - in VBA window, click
menu Debug > Compile to make sure there are no errors in code.

Run form, try to enter text in field "reason" both without and with
spell errors. It should pop-up spell checker when there is an error
only, without message "Spell Check completed".

Above approach will run Spell Check for particular field only and for
the one record only - the one which got new value.

Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -

- Show quoted text -
thank you very much for your time
 
K

kevcar40

Open form in Design View, select field(s) for which you want to run
SpellCheck, open Properties window and find in the list property
"Tag". Write there "SpellCheck" (without quotes).
In your case select field "reason", find in Property window event
AfterUpdate, select [Event Procedure] and click "...". Code should
look like this:
Private Sub reason_AfterUpdate()
  Call CheckSpelling(Me)
End Sub
Add new module, copy above function (Function CheckSpelling) and save
it by name "modSpellCheck". While you are there - in VBA window, click
menu Debug > Compile to make sure there are no errors in code.
Run form, try to enter text in field "reason" both without and with
spellerrors. It should pop-upspellcheckerwhen there is an error
only, without message "SpellCheck completed".
Above approach will runSpellCheck for particular field only and for
the one record only - the one which got new value.
Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -
- Show quoted text -

thank you very much for your time- Hide quoted text -

- Show quoted text -


i have followed your instruction
my Event procedure looks like the following
Private Sub Reason_AfterUpdate()
Forms![Block]![Block Inhibitors]![Text17].Value = Forms![Block]!
[Dates].Value
Call CheckSpelling(Me)
End Sub

problem is if there is an incorrectly spelt word
i get the following error message

"the macro or function set to the beforeupdate or validationRule
property for this field is preventing Microsoft Office Access from
saving the data in the field

if this is a macro, open the macro in the macro window and reomve the
action that forces the save
if the macro includes a setvalue action, set the macro to Afterupdate
property of the control instead
if this is a function, redfine the function in the module window"

This error pops up when change has been selected for the incorrectly
spelt word

an ideas

thank

kevin
 
M

[MVP]

Hi
i have the following code to check the spelling ot text enteredinto a
text box
it works fine
however a message box appears saying Spelling check complete ifthere
is no spelling error
If Len(Me!Reason & "") > 0 Then
        DoCmd.RunCommand acCmdSpelling
            Else
        Exit Sub
End If
Is it possible to stop this message appearing if there is no spelling
mistake
thanks
kevin
Hi,
Private Sub Text_AfterUpdate()
    'Call CheckSpelling(Me)
    If Len(Me!text & "") > 0 Then
        DoCmd.SetWarnings False
        DoCmd.RunCommand acCmdSpelling
        DoCmd.SetWarnings True
    Else
        Exit Sub
    End If
End Sub
However, this willspell-check all the fields/records. Better approach
is to use the following code - add tag property "SpellCheck" for field
(s) for which you want to runspellcheck:
Private Sub Text_AfterUpdate()
Call CheckSpelling(Me)
End Sub
Function CheckSpelling(ByRef frmFormName As Form)
Dim ctlControlName As Control
DoCmd.SetWarnings False
For Each ctlControlName In frmFormName
Select Case ctlControlName.ControlType
Case acTextBox
If Nz(ctlControlName, "") <> "" Then
If ctlControlName.Tag = "SpellCheck" Then
With ctlControlName
.SetFocus
.SelStart = 0
.SelLength = Len(ctlControlName)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
End Select
Next ctlControlName
DoCmd.SetWarnings True
End Function
Add spaces/tabs to code to have it readable.
Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -
- Show quoted text -
ok trying it now
 can you give me a little clarification please
my form is called inhibitors
the text box to check is called reason
Do i need to change    "ByRef frmFormName As Form" to  "ByRef
inhibitors As Form
and all occurrances of frmFormname
and do i need to change ctlcontrolName to Me.reason
thanks again
kevin
Hi,
Open form in Design View, select field(s) for which you want to run
SpellCheck, open Properties window and find in the list property
"Tag". Write there "SpellCheck" (without quotes).
In your case select field "reason", find in Property window event
AfterUpdate, select [Event Procedure] and click "...". Code should
look like this:
Private Sub reason_AfterUpdate()
  Call CheckSpelling(Me)
End Sub
Add new module, copy above function (Function CheckSpelling) and save
it by name "modSpellCheck". While you are there - in VBA window, click
menu Debug > Compile to make sure there are no errors in code.
Run form, try to enter text in field "reason" both without and with
spellerrors. It should pop-upspellcheckerwhen there is an error
only, without message "SpellCheck completed".
Above approach will runSpellCheck for particular field only and for
the one record only - the one which got new value.
Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -
- Show quoted text -
thank you very much for your time- Hide quoted text -
- Show quoted text -

i have followed your instruction
my Event procedure looks like the following
Private Sub Reason_AfterUpdate()
    Forms![Block]![Block Inhibitors]![Text17].Value = Forms![Block]!
[Dates].Value
    Call CheckSpelling(Me)
End Sub

problem is if there is an incorrectly spelt word
i get the following  error message

"the macro or function set to the beforeupdate or validationRule
property for this field is preventing Microsoft Office Access from
saving the data in the field

if this is a macro, open the macro in the macro window and reomve the
action that forces the save
if the macro includes a setvalue action, set the macro to Afterupdate
property of the control instead
if this is a function, redfine the function in the module window"

This error pops up when change has been selected for the incorrectly
spelt word

an ideas

thank

kevin

Hi,

What this does:

Forms![Block]![Block Inhibitors]![Text17].Value = Forms![Block]!
[Dates].Value

?

When you type in field "reason" some text does spell check works or
not?

Regards,
Branislav
 
K

kevcar40

Hi
i have the following code to check the spelling ot text entered into a
text box
it works fine
however a message box appears saying Spelling check complete if there
is no spelling error
If Len(Me!Reason & "") > 0 Then
        DoCmd.RunCommand acCmdSpelling
            Else
        Exit Sub
End If
Is it possible to stop this message appearing if there is no spelling
mistake
thanks
kevin
Hi,
Private Sub Text_AfterUpdate()
    'Call CheckSpelling(Me)
    If Len(Me!text & "") > 0 Then
        DoCmd.SetWarnings False
        DoCmd.RunCommand acCmdSpelling
        DoCmd.SetWarnings True
    Else
        Exit Sub
    End If
End Sub
However, this willspell-check all the fields/records. Better approach
is to use the following code - add tag property "SpellCheck" for field
(s) for which you want to runspellcheck:
Private Sub Text_AfterUpdate()
Call CheckSpelling(Me)
End Sub
Function CheckSpelling(ByRef frmFormName As Form)
Dim ctlControlName As Control
DoCmd.SetWarnings False
For Each ctlControlName In frmFormName
Select Case ctlControlName.ControlType
Case acTextBox
If Nz(ctlControlName, "") <> "" Then
If ctlControlName.Tag = "SpellCheck" Then
With ctlControlName
.SetFocus
.SelStart = 0
.SelLength = Len(ctlControlName)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
End Select
Next ctlControlName
DoCmd.SetWarnings True
End Function
Add spaces/tabs to code to have it readable.
Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -
- Show quoted text -
ok trying it now
 can you give me a little clarification please
my form is called inhibitors
the text box to check is called reason
Do i need to change    "ByRef frmFormName As Form" to  "ByRef
inhibitors As Form
and all occurrances of frmFormname
and do i need to change ctlcontrolName to Me.reason
thanks again
kevin
Hi,
Open form in Design View, select field(s) for which you want to run
SpellCheck, open Properties window and find in the list property
"Tag". Write there "SpellCheck" (without quotes).
In your case select field "reason", find in Property window event
AfterUpdate, select [Event Procedure] and click "...". Code should
look like this:
Private Sub reason_AfterUpdate()
  Call CheckSpelling(Me)
End Sub
Add new module, copy above function (Function CheckSpelling) and save
it by name "modSpellCheck". While you are there - in VBA window, click
menu Debug > Compile to make sure there are no errors in code.
Run form, try to enter text in field "reason" both without and with
spellerrors. It should pop-upspellcheckerwhen there is an error
only, without message "SpellCheck completed".
Above approach will runSpellCheck for particular field only and for
the one record only - the one which got new value.
Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -
- Show quoted text -
thank you very much for your time- Hide quoted text -
- Show quoted text -
i have followed your instruction
my Event procedure looks like the following
Private Sub Reason_AfterUpdate()
    Forms![Block]![Block Inhibitors]![Text17].Value = Forms![Block]!
[Dates].Value
    Call CheckSpelling(Me)
End Sub
problem is if there is an incorrectly spelt word
i get the following  error message
"the macro or function set to the beforeupdate or validationRule
property for this field is preventing Microsoft Office Access from
saving the data in the field
if this is a macro, open the macro in the macro window and reomve the
action that forces the save
if the macro includes a setvalue action, set the macro to Afterupdate
property of the control instead
if this is a function, redfine the function in the module window"
This error pops up when change has been selected for the incorrectly
spelt word
an ideas

kevin

Hi,

What this does:

Forms![Block]![Block Inhibitors]![Text17].Value = Forms![Block]!
[Dates].Value

?

When you type in field "reason" some text doesspellcheck works or
not?

Regards,
Branislav- Hide quoted text -

- Show quoted text -

this moves a value from the main form to the sub form
 
K

kevcar40

Hi
i have the following code to check the spelling ot text entered into a
text box
it works fine
however a message box appears saying Spelling check complete if there
is no spelling error
If Len(Me!Reason & "") > 0 Then
        DoCmd.RunCommand acCmdSpelling
            Else
        Exit Sub
End If
Is it possible to stop this message appearing if there is no spelling
mistake
thanks
kevin
Hi,
Private Sub Text_AfterUpdate()
    'Call CheckSpelling(Me)
    If Len(Me!text & "") > 0 Then
        DoCmd.SetWarnings False
        DoCmd.RunCommand acCmdSpelling
        DoCmd.SetWarnings True
    Else
        Exit Sub
    End If
End Sub
However, this willspell-check all the fields/records. Better approach
is to use the following code - add tag property "SpellCheck" for field
(s) for which you want to runspellcheck:
Private Sub Text_AfterUpdate()
Call CheckSpelling(Me)
End Sub
Function CheckSpelling(ByRef frmFormName As Form)
Dim ctlControlName As Control
DoCmd.SetWarnings False
For Each ctlControlName In frmFormName
Select Case ctlControlName.ControlType
Case acTextBox
If Nz(ctlControlName, "") <> "" Then
If ctlControlName.Tag = "SpellCheck" Then
With ctlControlName
.SetFocus
.SelStart = 0
.SelLength = Len(ctlControlName)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
End Select
Next ctlControlName
DoCmd.SetWarnings True
End Function
Add spaces/tabs to code to have it readable.
Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -
- Show quoted text -
ok trying it now
 can you give me a little clarification please
my form is called inhibitors
the text box to check is called reason
Do i need to change    "ByRef frmFormName As Form" to  "ByRef
inhibitors As Form
and all occurrances of frmFormname
and do i need to change ctlcontrolName to Me.reason
thanks again
kevin
Hi,
Open form in Design View, select field(s) for which you want to run
SpellCheck, open Properties window and find in the list property
"Tag". Write there "SpellCheck" (without quotes).
In your case select field "reason", find in Property window event
AfterUpdate, select [Event Procedure] and click "...". Code should
look like this:
Private Sub reason_AfterUpdate()
  Call CheckSpelling(Me)
End Sub
Add new module, copy above function (Function CheckSpelling) and save
it by name "modSpellCheck". While you are there - in VBA window, click
menu Debug > Compile to make sure there are no errors in code.
Run form, try to enter text in field "reason" both without and with
spellerrors. It should pop-upspellcheckerwhen there is an error
only, without message "SpellCheck completed".
Above approach will runSpellCheck for particular field only and for
the one record only - the one which got new value.
Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -
- Show quoted text -
thank you very much for your time- Hide quoted text -
- Show quoted text -
i have followed your instruction
my Event procedure looks like the following
Private Sub Reason_AfterUpdate()
    Forms![Block]![Block Inhibitors]![Text17].Value = Forms![Block]!
[Dates].Value
    Call CheckSpelling(Me)
End Sub
problem is if there is an incorrectly spelt word
i get the following  error message
"the macro or function set to the beforeupdate or validationRule
property for this field is preventing Microsoft Office Access from
saving the data in the field
if this is a macro, open the macro in the macro window and reomve the
action that forces the save
if the macro includes a setvalue action, set the macro to Afterupdate
property of the control instead
if this is a function, redfine the function in the module window"
This error pops up when change has been selected for the incorrectly
spelt word
an ideas

kevin

Hi,

What this does:

Forms![Block]![Block Inhibitors]![Text17].Value = Forms![Block]!
[Dates].Value

?

When you type in field "reason" some text doesspellcheck works or
not?

Regards,
Branislav- Hide quoted text -

- Show quoted text -

when i type correct spellig in to reason text box
i get no problem
when i mis spell a word the spell checker pops upwhen i click change i
get the message
and when i close the form i get the same message
 
M

[MVP]

Hi
i have the following code to check the spelling ot text entered into a
text box
it works fine
however a message box appears saying Spelling check complete if there
is no spelling error
If Len(Me!Reason & "") > 0 Then
        DoCmd.RunCommand acCmdSpelling
            Else
        Exit Sub
End If
Is it possible to stop this message appearing if there is no spelling
mistake
thanks
kevin
Hi,
Private Sub Text_AfterUpdate()
    'Call CheckSpelling(Me)
    If Len(Me!text & "") > 0 Then
        DoCmd.SetWarnings False
        DoCmd.RunCommand acCmdSpelling
        DoCmd.SetWarnings True
    Else
        Exit Sub
    End If
End Sub
However, this willspell-check all the fields/records. Better approach
is to use the following code - add tag property "SpellCheck" for field
(s) for which you want to runspellcheck:
Private Sub Text_AfterUpdate()
Call CheckSpelling(Me)
End Sub
Function CheckSpelling(ByRef frmFormName As Form)
Dim ctlControlName As Control
DoCmd.SetWarnings False
For Each ctlControlName In frmFormName
Select Case ctlControlName.ControlType
Case acTextBox
If Nz(ctlControlName, "") <> "" Then
If ctlControlName.Tag = "SpellCheck" Then
With ctlControlName
.SetFocus
.SelStart = 0
.SelLength = Len(ctlControlName)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
End Select
Next ctlControlName
DoCmd.SetWarnings True
End Function
Add spaces/tabs to code to have it readable.
Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -
- Show quoted text -
ok trying it now
 can you give me a little clarification please
my form is called inhibitors
the text box to check is called reason
Do i need to change    "ByRef frmFormName As Form" to  "ByRef
inhibitors As Form
and all occurrances of frmFormname
and do i need to change ctlcontrolName to Me.reason
thanks again
kevin
Hi,
Open form in Design View, select field(s) for which you want to run
SpellCheck, open Properties window and find in the list property
"Tag". Write there "SpellCheck" (without quotes).
In your case select field "reason", find in Property window event
AfterUpdate, select [Event Procedure] and click "...". Code should
look like this:
Private Sub reason_AfterUpdate()
  Call CheckSpelling(Me)
End Sub
Add new module, copy above function (Function CheckSpelling) and save
it by name "modSpellCheck". While you are there - in VBA window, click
menu Debug > Compile to make sure there are no errors in code.
Run form, try to enter text in field "reason" both without and with
spellerrors. It should pop-upspellcheckerwhen there is an error
only, without message "SpellCheck completed".
Above approach will runSpellCheck for particular field only and for
the one record only - the one which got new value.
Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -
- Show quoted text -
thank you very much for your time- Hide quoted text -
- Show quoted text -
i have followed your instruction
my Event procedure looks like the following
Private Sub Reason_AfterUpdate()
    Forms![Block]![Block Inhibitors]![Text17].Value = Forms![Block]!
[Dates].Value
    Call CheckSpelling(Me)
End Sub
problem is if there is an incorrectly spelt word
i get the following  error message
"the macro or function set to the beforeupdate or validationRule
property for this field is preventing Microsoft Office Access from
saving the data in the field
if this is a macro, open the macro in the macro window and reomve the
action that forces the save
if the macro includes a setvalue action, set the macro to Afterupdate
property of the control instead
if this is a function, redfine the function in the module window"
This error pops up when change has been selected for the incorrectly
spelt word
an ideas
thank
kevin

What this does:
Forms![Block]![Block Inhibitors]![Text17].Value = Forms![Block]!
[Dates].Value

When you type in field "reason" some text doesspellcheck works or
not?
Regards,
Branislav- Hide quoted text -
- Show quoted text -

when i type correct spellig in to reason text box
i get no problem
when i mis spell a word the spell checker pops upwhen i click change i
get the message
and when i close the form i get the same message

Hi,

This:

Private Sub Text_AfterUpdate()
Call CheckSpelling(Me)
End Sub

runs the spell check code only when text is updated, that is if you
update text and close form without moving cursor to other field/
record, code will run.

Regards,
Branislav Mihaljev
Microsoft Access MVP
 

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