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

Spell checker

P: n/a
I am trying to use the spell checker on an unbound control in Access
2000. I run the checker in the AfterUpdate event of the control.
After the spell checker is done, I get the following message:

The Macro or Function set to the BeforeUpdate or ValidationRule
Property for this field is preventing MS Access from saving the data
in the field.

I have no validation code or mask and no code in the Before
Update event.
This is the spell checker code:

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

Any ideas?
Hank Reed
Nov 13 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hank Reed wrote:
I am trying to use the spell checker on an unbound control in Access
2000. I run the checker in the AfterUpdate event of the control.
After the spell checker is done, I get the following message:

The Macro or Function set to the BeforeUpdate or ValidationRule
Property for this field is preventing MS Access from saving the data
in the field.

I have no validation code or mask and no code in the Before
Update event.
This is the spell checker code:

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

Any ideas?
Hank Reed


I made a copy of your form, created a command button called Spell and
ran your code. It ran fine.

I then put your code in the afterupdate event of control and ran it and
got your error.

I then modified your code to below and got the same error.

I then moved the modified code to the LostFocus event and it ran fine.

I am not sure why you want to enumerate all controls when you are
wanting to spellcheck a single control. Anyway, see if the below works
in the LostFocus.

Dim ctlSpell As Control
Set ctlSpell = Me.ActiveControl
If Len(ctlSpell) > 0 Then
With ctlSpell
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
End With
DoCmd.RunCommand acCmdSpelling
End If
Nov 13 '05 #2

P: n/a


I didn't actually want to spell check all controls. That was just
the sample code I got off of the NG. I also made it work from the
LostFocus event but you may find that you can never go to ay other
control as the spell checker will run on every LostFocus and send you
right back to the original control.

One curious thing is that if I programatically highlight the text
and then manually hit F7, it works fine.

Thanks
Hank Reed

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3

P: n/a
Hank wrote:

I didn't actually want to spell check all controls. That was just
the sample code I got off of the NG. I also made it work from the
LostFocus event but you may find that you can never go to ay other
control as the spell checker will run on every LostFocus and send you
right back to the original control.
????. I don't follow you. The code I provided spell checks only 1 control.

I'm not sure why you didn't use the code I provided to spell check the
control you were on instead of continuing to use code to enumerate all
of the controls and spell check them all.. Well, if it works the way
you want, that's the important thing.

One curious thing is that if I programatically highlight the text
and then manually hit F7, it works fine.

Thanks
Hank Reed

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #4

P: n/a
Salad,
Thanks for your continued interest but I don't think you read my
response. I only want to check ONE CONTROL. What I posted was some
sample code off the NG. Whether I am checking one or more controls, the
real problem is that Access does not allow the spell checker to update
the text and gives the error message stated above.
Also I didn't mean that I would be satisfied with the F7 solution.
I only mentioned it as another clue.
I am hoping someone will know what the error message means and how
to get around it.
Thanks again,
Hank Reed

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5

P: n/a
Hank wrote:
Salad,
Thanks for your continued interest but I don't think you read my
response.
I did.

I only want to check ONE CONTROL.

OK. What part of the code I provide do you not understand?

What I posted was some sample code off the NG.
And so you modify it. As I did.

Whether I am checking one or more controls, the real problem is that Access does not allow the spell checker to update
the text and gives the error message stated above.
Not true. I think you need a programmer at this point. You were given
a solution that you don't understand.
Also I didn't mean that I would be satisfied with the F7 solution.
I only mentioned it as another clue.
I am hoping someone will know what the error message means and how
to get around it.


You were given the solution. Take a horse to water but you can't make
them drink and so forth....
Nov 13 '05 #6

P: n/a
Salad,
What is the point of your rudeness? I am a programmer and have
probably been doing this longer than you. A huge problem with this NG
is that when a reader doesn't understand the post he chooses to bite
someones head off. The lack of understanding is usually caused by not
reading the post or not understanding the question. I have had many
answers from posters who simply said, "Why would you want to do that?"
Not very contructive.
I have no desire to continue this diatribe and I hope you don't.
Thanks for your efforts.
Hank Reed

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #7

P: n/a
Hank wrote:
Salad,
What is the point of your rudeness?


Your tone was actually rather impatient, though you probably didn't mean
it, after s/he'd done all that testing for you.
--
Tim - http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.