Results 1 to 4 of 4
  1. #1
    coben is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    1

    Spellchecking Entire Record in an Access Form

    Ok, this is my first post, so please excuse any new user errors in posting.
    I have a DB form that I’m attempting to run a spellchecker on for the entire form (current record only), but keep getting a run-time error 2424 upon its completion. I came across the follow code from another user that I'm using in a standard module:

    Public Function SpellChecker()

    Dim ctrl As Control

    Dim frm As Form

    Set frm = Screen.ActiveForm

    DoCmd.SetWarnings False

    For Each ctrl In frm.Controls

    If TypeOf ctrl Is TextBox Then
    If Len(ctrl) > 0 Then
    With ctrl
    .SetFocus
    .SelStart = 0
    .SelLength = Len(ctrl)
    End With

    DoCmd.RunCommand acCmdSpelling

    End If


    End If

    Next

    DoCmd.SetWarnings True

    End Function

    I then have a cmd button on the form to call the spellchecker:

    Private Sub SpellChecker_Click()
    Call SpellChecker
    End Sub

    The spellchecker works great, but after completing the function for the current records, it gives me the 2424 error. When debugging, it points to If Len(ctrl) >0 then as the problem.
    Not quite sure what I'm doing wrong, but must admit that although I've been building DBs for a while, my coding skills are only average.

    Any suggestions or corrections would be greatly appreciated.

    Thanks

  2. #2
    GinaWhipp's Avatar
    GinaWhipp is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2011
    Location
    Ohio, USA
    Posts
    377
    Hmm, well are all the Controls text boxes? I would also make sure you Control Names are not the same as your Field Names.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    helps if you explain what the 2424 error is - and the specific error since it may provide a clue as to the problem.

    but after completing the function for the current records
    There is nothing in your code to indicate this error occurs after completing for the current record - or that the 'focus' has moved to a different activeform.

    Also suggest you reenable error reporting until you have this resolved

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Error 2424 = The expression you entered has a field, control, or property name that Microsoft Access can't find.
    This will be followed by the name of the offending item.
    Modify your code or control name accordingly
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 6
    Last Post: 02-02-2015, 02:14 PM
  2. Copy Entire Record
    By pcli in forum SharePoint
    Replies: 8
    Last Post: 04-23-2012, 03:48 PM
  3. Replies: 3
    Last Post: 04-01-2012, 01:11 PM
  4. Replies: 3
    Last Post: 09-18-2011, 03:46 PM
  5. Replies: 9
    Last Post: 12-28-2009, 04:01 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