Share via

Fixing access spell check error

Anonymous
2017-05-09T13:27:37+00:00

I have code to spell check a particular field ( Notes). However when I tried to add spell check another field I get a run time error (2185).  I have  searched Google, but was not successful in finding a resolution to the problem.

Spellcheck works on the Notes field using "On Lost Focus" Here is the code:

Private Sub Notes_LostFocus()

With Me!Notes

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

When I  tried to  do spell check on another field (Application Method). I receive error messages, depending on where I place the code. If I use the same code as above & replace With Me!Notes with With Me!Application Method on lost focus, I get a run time error of 2185.  If I use different code & place it on exit, I get a syntax error, & it hangs on With Me!Application Method . Here is the code that I used on exit:

 Private Sub Application_Method_Exit(Cancel As Integer)

With Me!Application Method

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

I am very confused. Could you please explain the difference between "On Lost Focus" & on exit. Which is better, & how I can fix the problem, so the code runs?

***Post moved by the moderator to the appropriate forum category.***

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2017-05-09T17:13:27+00:00

I feel so stupid. MS was telling exactly what the problem was, & I just couldn't see it. Once I replaced  With Me!Application Method with With Me.Application Method. It worked perfectly. I hope this helps others.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful