Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2005
    Posts
    240

    Unanswered: Running spell check and get runtime error

    Hi all,

    I'm having difficulties trying to get a spell check to work on one of my forms.
    I keep getting the following:

    Run-time error '2046':
    The command or action 'Spelling' isn't available now.
    This error keeps occuring when trying to execute the run command for the spell checker.

    My Code:

    Code:
    Private Sub cmdSpell_Click()
       Dim ctlSpell As Control
     
       Set ctlSpell = Screen.PreviousControl
       If TypeOf ctlSpell Is TextBox Then
         If IsNull(Len(ctlSpell)) Or Len(ctlSpell) = 0 Then
           MsgBox "There is nothing to spell check."
           ctlSpell.SetFocus
           Exit Sub
         End If
         With ctlSpell
           .SetFocus
           .SelStart = 0
           .SelLength = Len(ctlSpell)
         End With
         DoCmd.RunCommand acCmdSpelling
     Else
         MsgBox "Spell check is not available for this item."
       End If
       ctlSpell.SetFocus
     
    End Sub
    I only want to run the spell checker on one control, and even tried setting the ctlSpell variable to the name of the textbox control, but I still get this same problem.

    Does anyone know a solution, or an alternative method for spell checking?

    Thanks.

  2. #2
    Join Date
    Dec 2006
    Posts
    53
    Have you been able to use spell-check in Access otherwise? That error almost sounds like the add-on is not installed. Better yet, if you insert your cursor into the field for which you are trying to programming spellcheck, can you then click Tools, Spelling? I just tried it on one of my forms, and the Spelling tool was unavailable, but of course then I realized I was in a disabled control.
    Last edited by dfwelch; 01-04-07 at 09:21.

  3. #3
    Join Date
    Sep 2005
    Posts
    240
    Yes, that's the weird thing I have been able to do this before in another database.

    Which add-on should be installed for this to work?

  4. #4
    Join Date
    Dec 2006
    Posts
    53
    Well, you might have the add on you need. Can you insert your cursor into the field for which you are trying to program spellcheck? When you click Tools, is Spelling available?

  5. #5
    Join Date
    Sep 2005
    Posts
    240
    Interesting no it isn't.

  6. #6
    Join Date
    Sep 2005
    Posts
    240
    OK sorted it now.

    Turns out I had put the forms 'Allow Edits' property to 'No'.

    Lol, what a noob

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    try placing the command within the with block

    Code:
         With ctlSpell
           .SetFocus
           .SelStart = 0
           .SelLength = Len(ctlSpell)
         DoCmd.RunCommand acCmdSpelling
         End With
    I'd rather be riding on the Tiger 800 or the Norton

  8. #8
    Join Date
    Sep 2005
    Posts
    240
    Quote Originally Posted by healdem
    try placing the command within the with block
    Alright, that will also help as well

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •