Results 1 to 8 of 8
  1. #1
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86

    Auto Spell Check in Form Field

    I am using some code in the in the Lost_Focus Event to auto spell check some fields in a form.
    For 2 of the fields the code works great, but when I put into another field is says there is a problem with the .SelStart = 1 in code.


    All fields are memo fields. The code I am using is below. I cannot figure out why it works in one field but not the other.
    Any suggestions would be appreciated.


    With Me!Financial_Status
    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

  2. #2
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    I believe you need to set focus to the control before using SelStart and SelLength: Inside your With - .SetFocus before these commands.

  3. #3
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86
    If this is the case why would it work in one field and not the other?

  4. #4
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Did you at least try the suggestion???

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Focus is already on the Control while it's LostFocus event is firing, and as the OP states, why would it work for two Controls but not the third one?

    In testing, the posted code works, even if the Control is empty, without erroring out, so the code, itself, is not at fault.

    Have you tried testing the code on yet another Memo Field Control? I'd do that, even if you have to temporarily create another Field and Control to do so, to see if it's only this Control that has the problem.

    Although we usually think of Forms, or entire Databases, when we speak of corruption, individual Controls, can and do become corrupted. The test and the fix are one and the same; deleting the Control then re-creating it! If it was corrupt, you've verified the fact and solved the problem! If not, you've only lost a minute or two!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86
    It still does not work error says Run-time error '438' Object doesn't support property or method.

  7. #7
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86
    Thank you! I deleted the control and added it back to the form. Then I applied the code and Viola!!! it works.

  8. #8
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Glad you got it working!

    Good luck with your project!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 11-07-2016, 11:05 AM
  2. Replies: 12
    Last Post: 01-27-2016, 12:23 PM
  3. Replies: 1
    Last Post: 05-12-2014, 07:42 AM
  4. Spell and grammar check
    By destroyer in forum Forms
    Replies: 1
    Last Post: 01-19-2014, 11:51 AM
  5. Code to spell out check amount?
    By spkoest in forum Access
    Replies: 4
    Last Post: 06-16-2009, 07:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums