Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA spell check cannot save data in field

Status
Not open for further replies.

daveh

Technical User
Jun 22, 2000
57
GB
I have a field which afterupdate runs the following code...

Code:
Private Sub Comments_AfterUpdate()
  Comments.SetFocus

  If Len(Comments) > 0 Then
     Comments.SelStart = 1
     Comments.SelLength = Len(Comments)
     DoCmd.RunCommand acCmdSpelling
  End If

End Sub

This runs a spell check fine if there is any text in the field. However, if there is a spelling/grammar error, when it picks it up and I choose "change" to change it to the correct spelling/grammar, the following error appears:

The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Access from saving the data in the field.

* If this is a macro, open the macro in the Macro window and remove the action that forces a save (for example, GoToControl)
* If the macro includes a SetValue action, set the macro to AfterUpdate property of the control instead
* If this is a function, redefine the function in the Module window

The code for the function is already afterupdate, and I have no code in the BeforeUpdate event. I'm not sure what to do.

Thanks,
David.

 
Have you tried to put your code in the BeforeUpdate event procedure instead of the AfterUpdate one ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi PH,

I haven't - but the whole point of the procedure is that once they have inputted their comment, the spellcheck is then run. Before update would spell check other entries but not the one in question.

Dave.
 
Try the On Lost Focus Event or if that doesn't work try the After Update event of the form.

Hope this helps.

 
I'm trying to use spell check as well, but I want to do it from a button, to be used when they want to, instead of every time this field is filled.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top