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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spellcheck that ignores other fields

Status
Not open for further replies.

Bandenjamin

Programmer
Oct 18, 2005
649
US
I know there are already a hundred posts about spell check here but I couldn't find an answer for the last part of my issue. I have a form that has multiple text boxes. On exiting a particular box I want to have it spell check that box, but ignore the others. Right now I have the following code on after update

Private Sub ReviewerComments_AfterUpdate()
Me.ReviewerComments.SetFocus
DoCmd.RunCommand acCmdSpelling
End Sub

The spell check is launching fine, however, it jumps to the other two fields as well, which I do not want.

Suggestions?

Thanks,

Dan
 
You may try this:
With Me!ReviewerComments
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
DoCmd.RunCommand acCmdSpelling

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
When i tried that code gives me the following messages

1st message

The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Call Review Database 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 the AfterUpdate property of the control instead.

*If this is a function, redefine the function in the Module window.

I have verified that the field does not have a validation rule, and there is no macros associated with any field on the form. There is also nothing in the BeforeUpdate property either. After clicking "OK" get the next message

2nd message


An error occurred while trying to modify the contents of field 'ReviewerComments.'

The field may be locked or read-only, or you may not have permissions to change it. For inofrmation on security permissions and who can change them, click Help.

The field is not locked, and I am logged in as administrator so not sure why that message comes up

If I remove the .SelLength = Len(.Text) then it seems to work ok but still checks other columns of the data sheet.

Am I missing something here? Does the (.Text) need to be more specific?
 
Perhaps this ?
With Me!ReviewerComments
.SetFocus
.SelStart = 0
.SelLength = Len(.Value)
End With
DoCmd.RunCommand acCmdSpelling

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Tried that. Same results. Did i get something wrong here?

Private Sub ReviewerComments_AfterUpdate()
With Me!ReviewerComments
.SetFocus
.SelStart = 0
.SelLength = Len(.Value)
End With
DoCmd.RunCommand acCmdSpelling
End Sub
 
Have you tried the BeforeUpdate event instead ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
If I move it to BeforeUpdate it doesn't check anything. If I tell the spell checker to Ignore misspelled words it seems to work just like I want it to, but when I try to corrcct the spelling of a word I get the two error messages listed above.
 
I've used this without problems for quite some time:

Code:
Private Sub ControlToCheck_Exit(Cancel As Integer)
With Me!ControlToCheck
  Me.ControlToCheck.SetFocus
  
  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
Me.NextControl.SetFocus 'Sets to next control 
End Sub

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Missinglinq,

Tried your code there and get the same result as I do with the previous code. I verified that nothing is set in before update or validation rules for the field, but it still persists.

 
My next step would be to do the old open a blank database and import everything into it, in case yours has become corrupted.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Created a fresh database with one table, two memo fields calls "comments" & "comments2". Created a form with these two fields and input the code, Same results with two error messages.
 
Ok almost have this one licked. I disabled the other field (user's will not be editing anyway) and that fixed the problem of checking that field. Now one last question to this and I'll be happy.

How can I get the spell check complete box to stop popping up?
 
Figured it out. The following code will work if anyone else runs in to this.

DoCmd.SetWarnings False 'Turn off System Warning if spell check returns no error.
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdSpelling
DoCmd.SetWarnings True 'Turn back on the System Warnings
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top