Spell Check - Access Runtime (1 Viewer)

dferr1234

New member
Local time
Today, 04:38
Joined
Feb 6, 2024
Messages
1
Does anyone have any ideas on how to run spell check on an access runtime application?
 

Jon

Access World Site Owner
Staff member
Local time
Today, 09:38
Joined
Sep 28, 1999
Messages
7,396
Welcome to Access World! We're so happy to have you join us as a member of our community. As the most active Microsoft Access discussion forum on the internet, with posts dating back more than 20 years, we have a wealth of knowledge and experience to share with you.

We're a friendly and helpful community, so don't hesitate to ask any questions you have or share your own experiences with Access. We're here to support you and help you get the most out of this powerful database program.

To get started, we recommend reading the post linked below. It contains important information for all new users of the forum:

https://www.access-programmers.co.uk/forums/threads/new-member-read-me-first.223250/

We hope you have a great time participating in the discussion and learning from other Access enthusiasts. We look forward to having you around!
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:38
Joined
Sep 21, 2011
Messages
14,301
Just the normal way I would have thought?
What is special about the runtime ? in running vba code?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:38
Joined
Oct 29, 2018
Messages
21,473
Hi. Welcome to AWF!

I have moved your thread out of the introduction forum.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:38
Joined
Feb 19, 2002
Messages
43,275
I'm having a senior moment. I do remember having a problem with spell check and the runtime. I found this module which is named "modSpellcheckForRuntime" so I guess it solves the problem. I didn't look closely at the code. Part is commented out. That may be the part that doesn't work with the runtime so ignore it.
Code:
Option Compare Database
Option Explicit

Public Sub cmdSpell_EntireForm(frm)
   Dim ctlSpell As Control
   Dim ctlName As String

   On Error GoTo Err_Proc

   DoCmd.SetWarnings False
   ' Enumerate Controls collection.
  
   For Each ctlSpell In frm.Controls
     If TypeOf ctlSpell Is TextBox Then
       If Len(ctlSpell) > 0 Then
         With ctlSpell
           .SetFocus
           .SelStart = 0
           .SelLength = Len(ctlSpell)
         End With
         DoCmd.RunCommand acCmdSpelling
         If ctlName = ctlSpell.name Then
            GoTo Exit_Proc
         Else
            ctlName = ctlSpell.name
         End If
       End If
     End If
   Next
   DoCmd.SetWarnings True

Exit_Proc:
   On Error GoTo 0
   Exit Sub

Err_Proc:

    Select Case Err.Number
        Case Else
            MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdSpell_EntireForm of Module mSpellCheckForRuntime"
    End Select
 End Sub

Public Sub cmdSpell_SingleControl(cntl As Control)
    Dim ctlSpell As Control
    
   On Error GoTo Err_Proc

    Set ctlSpell = cntl 'Screen.PreviousControl
    If IsNull(Len(ctlSpell)) Or Len(ctlSpell) = 0 Then
        'MsgBox "There is nothing to spell check."
        'ctlSpell.SetFocus
        Exit Sub
    End If
            
    DoCmd.RunMacro "mWarningsOff"        'turn warnings off to surpress "complete" message
    With ctlSpell
      .SetFocus
      .SelStart = 0
      .SelLength = Len(ctlSpell)
    End With
    DoCmd.RunCommand acCmdSpelling
    DoCmd.RunMacro "mWarningsOn"

Exit_Proc:
   On Error GoTo 0
   Exit Sub

Err_Proc:

    Select Case Err.Number
        Case Else
            MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdSpell_SingleControl of Module mSpellCheckForRuntime"
    End Select
 End Sub

Public Sub cmdSpell_EntireRecordset()

''' doesn't seem to do anything when called from Before update event of form

    On Error GoTo Err_Proc

    DoCmd.SetWarnings False
    DoCmd.RunCommand acCmdSpelling
    DoCmd.SetWarnings True

Exit_Proc:
   On Error GoTo 0
   Exit Sub

Err_Proc:

    Select Case Err.Number
        Case Else
            MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdSpell_EntireRecordset of Module mSpellCheckForRuntime"
    End Select
 End Sub
 
''''''Public Sub cmdSpell_Click()
''''''   Dim ctlSpell As Control
''''''
''''''   On Error GoTo Err_Proc
''''''
''''''   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
''''''
''''''Exit_Proc:
''''''   On Error GoTo 0
''''''   Exit Sub
''''''
''''''Err_Proc:
''''''
''''''    Select Case Err.Number
''''''        Case Else
''''''            MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdSpell_Click of Module mSpellCheckForRuntime"
''''''    End Select
'''''' End Sub
''''''
Public Function SpellChecker(Calling As Form)

 Dim ctlSpell As Control

 DoCmd.RunMacro "mWarningsOff"
 Set ctlSpell = Calling.ActiveControl
 If (ctlSpell.Locked) Then
    ''Ignore
 Else
    If Len(ctlSpell) > 0 Then
        With ctlSpell
        .SetFocus
        .SelStart = 0
        .SelLength = Len(ctlSpell)
        End With
        DoCmd.RunCommand acCmdSpelling
    End If
End If
DoCmd.RunMacro "mWarningsOn"
End Function
 

Users who are viewing this thread

Top Bottom