Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Spell check still causing problems

Geek News

Spell check still causing problems
Dale Fye 12/10/2008 2:48:12 PM
I'm still having spell check problems.

I posted a note message to this board back in September, and never did
resolve the problem. I've worked on several other applications since then,
and have never resolved the problem I'm having with a spellcheck function
that I allow users to call via a shortcut menu. If they are in a textbox on
the main form, the function appears to run successfully, but if the control
that has the focus is on a subform, running this function causes Access
(2007) to lock up.

Public Function fnTextSpell()

Dim frm As Form
Dim ctrl As TextBox

'define the form that the popup was actually called from
Set frm = Screen.ActiveForm
While frm.ActiveControl.ControlType = 112
Set frm = frm.ActiveControl.Form
Wend

'Define the control on that form that has the focus
Set ctrl = frm.ActiveControl

'if no text is selected in the control, then select all the text
With ctrl
If ctrl.SelLength = 0 Then
ctrl.SelStart = 0
ctrl.SelLength = Len(ctrl.Text)
End If
End With

'Run the spellchecker against the selected text
' DoCmd.RunCommand acCmdSpelling
Application.RunCommand acCmdSpelling

End Function

Everything runs correctly, right up to the Runcommand acCmdSpelling, but
when the code encounters that line, I get the following warning message.
And, as you can see, I've tried both docmd.runcommand and
application.runcommand, both result in the same error and Access shutdown.

Microsoft Office Access has stopped working

Windows can try to recover your information and restart the program.

This most recent application involves a lot of long memo fields (on
subforms) , and I would really like my users to be able to use the spell
checker. Any help would be greatly appreciated.


--
HTH
Dale

email address is invalid
Please reply to newsgroup only.

Re: Spell check still causing problems
"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> 12/10/2008 6:42:00 PM
Try this one. It's worked on all versions of Access in the last 11 years:

Public Function Spell()
' Arvin Meyer 9/17/1998
' Adapted from code by Terry Wickenden
Dim ctlSpell As Control
Dim frm As Form
Set frm = Screen.ActiveForm
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
End If
End If
Next
DoCmd.SetWarnings True
End Function
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
news:0B8F0856-C642-4971-8296-3280088D7416[ at ]microsoft.com...
[Quoted Text]
> I'm still having spell check problems.
>
> I posted a note message to this board back in September, and never did
> resolve the problem. I've worked on several other applications since
> then,
> and have never resolved the problem I'm having with a spellcheck function
> that I allow users to call via a shortcut menu. If they are in a textbox
> on
> the main form, the function appears to run successfully, but if the
> control
> that has the focus is on a subform, running this function causes Access
> (2007) to lock up.
>
> Public Function fnTextSpell()
>
> Dim frm As Form
> Dim ctrl As TextBox
>
> 'define the form that the popup was actually called from
> Set frm = Screen.ActiveForm
> While frm.ActiveControl.ControlType = 112
> Set frm = frm.ActiveControl.Form
> Wend
>
> 'Define the control on that form that has the focus
> Set ctrl = frm.ActiveControl
>
> 'if no text is selected in the control, then select all the text
> With ctrl
> If ctrl.SelLength = 0 Then
> ctrl.SelStart = 0
> ctrl.SelLength = Len(ctrl.Text)
> End If
> End With
>
> 'Run the spellchecker against the selected text
> ' DoCmd.RunCommand acCmdSpelling
> Application.RunCommand acCmdSpelling
>
> End Function
>
> Everything runs correctly, right up to the Runcommand acCmdSpelling, but
> when the code encounters that line, I get the following warning message.
> And, as you can see, I've tried both docmd.runcommand and
> application.runcommand, both result in the same error and Access shutdown.
>
> Microsoft Office Access has stopped working
>
> Windows can try to recover your information and restart the program.
>
> This most recent application involves a lot of long memo fields (on
> subforms) , and I would really like my users to be able to use the spell
> checker. Any help would be greatly appreciated.
>
>
> --
> HTH
> Dale
>
> email address is invalid
> Please reply to newsgroup only.
>


Re: Spell check still causing problems
"Dale Fye" <dale.fye[ at ]nospam.com> 12/11/2008 12:23:30 AM
Arvin,

Tried it, but am still getting the same error and Access abort (mot much
difference between this and my code anyway, except looking at all textboxes
on the form, rather than only one).

I've been having this problem ever since we moved to Office 2007, and it has
happened on each of the three computers I've had during that period.

I've figured out that I can use F7 to do a spell check, and that seems to
work, although it appears to be doing it for every record in the main table,
rather than only the current record.

Any other suggestion would be considered.

Dale


"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
news:%23Z3a$bvWJHA.4632[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Try this one. It's worked on all versions of Access in the last 11 years:
>
> Public Function Spell()
> ' Arvin Meyer 9/17/1998
> ' Adapted from code by Terry Wickenden
> Dim ctlSpell As Control
> Dim frm As Form
> Set frm = Screen.ActiveForm
> 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
> End If
> End If
> Next
> DoCmd.SetWarnings True
> End Function
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>
> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
> news:0B8F0856-C642-4971-8296-3280088D7416[ at ]microsoft.com...
>> I'm still having spell check problems.
>>
>> I posted a note message to this board back in September, and never did
>> resolve the problem. I've worked on several other applications since
>> then,
>> and have never resolved the problem I'm having with a spellcheck function
>> that I allow users to call via a shortcut menu. If they are in a textbox
>> on
>> the main form, the function appears to run successfully, but if the
>> control
>> that has the focus is on a subform, running this function causes Access
>> (2007) to lock up.
>>
>> Public Function fnTextSpell()
>>
>> Dim frm As Form
>> Dim ctrl As TextBox
>>
>> 'define the form that the popup was actually called from
>> Set frm = Screen.ActiveForm
>> While frm.ActiveControl.ControlType = 112
>> Set frm = frm.ActiveControl.Form
>> Wend
>>
>> 'Define the control on that form that has the focus
>> Set ctrl = frm.ActiveControl
>>
>> 'if no text is selected in the control, then select all the text
>> With ctrl
>> If ctrl.SelLength = 0 Then
>> ctrl.SelStart = 0
>> ctrl.SelLength = Len(ctrl.Text)
>> End If
>> End With
>>
>> 'Run the spellchecker against the selected text
>> ' DoCmd.RunCommand acCmdSpelling
>> Application.RunCommand acCmdSpelling
>>
>> End Function
>>
>> Everything runs correctly, right up to the Runcommand acCmdSpelling, but
>> when the code encounters that line, I get the following warning message.
>> And, as you can see, I've tried both docmd.runcommand and
>> application.runcommand, both result in the same error and Access
>> shutdown.
>>
>> Microsoft Office Access has stopped working
>>
>> Windows can try to recover your information and restart the program.
>>
>> This most recent application involves a lot of long memo fields (on
>> subforms) , and I would really like my users to be able to use the spell
>> checker. Any help would be greatly appreciated.
>>
>>
>> --
>> HTH
>> Dale
>>
>> email address is invalid
>> Please reply to newsgroup only.
>>
>
>


Re: Spell check still causing problems
"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> 12/12/2008 4:54:34 AM
This the only code that is really active for spelling:

DoCmd.RunCommand acCmdSpelling

Try putting that in a function on the double-click event of 1 text box. If
you get an error, It may be because you do not have your database in a
Trusted location and have code enabled. It should run, and if this runs,
everything else should as well.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
news:eoxojeyWJHA.4768[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Arvin,
>
> Tried it, but am still getting the same error and Access abort (mot much
> difference between this and my code anyway, except looking at all
> textboxes on the form, rather than only one).
>
> I've been having this problem ever since we moved to Office 2007, and it
> has happened on each of the three computers I've had during that period.
>
> I've figured out that I can use F7 to do a spell check, and that seems to
> work, although it appears to be doing it for every record in the main
> table, rather than only the current record.
>
> Any other suggestion would be considered.
>
> Dale
>
>
> "Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
> news:%23Z3a$bvWJHA.4632[ at ]TK2MSFTNGP04.phx.gbl...
>> Try this one. It's worked on all versions of Access in the last 11 years:
>>
>> Public Function Spell()
>> ' Arvin Meyer 9/17/1998
>> ' Adapted from code by Terry Wickenden
>> Dim ctlSpell As Control
>> Dim frm As Form
>> Set frm = Screen.ActiveForm
>> 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
>> End If
>> End If
>> Next
>> DoCmd.SetWarnings True
>> End Function
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>>
>> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
>> news:0B8F0856-C642-4971-8296-3280088D7416[ at ]microsoft.com...
>>> I'm still having spell check problems.
>>>
>>> I posted a note message to this board back in September, and never did
>>> resolve the problem. I've worked on several other applications since
>>> then,
>>> and have never resolved the problem I'm having with a spellcheck
>>> function
>>> that I allow users to call via a shortcut menu. If they are in a
>>> textbox on
>>> the main form, the function appears to run successfully, but if the
>>> control
>>> that has the focus is on a subform, running this function causes Access
>>> (2007) to lock up.
>>>
>>> Public Function fnTextSpell()
>>>
>>> Dim frm As Form
>>> Dim ctrl As TextBox
>>>
>>> 'define the form that the popup was actually called from
>>> Set frm = Screen.ActiveForm
>>> While frm.ActiveControl.ControlType = 112
>>> Set frm = frm.ActiveControl.Form
>>> Wend
>>>
>>> 'Define the control on that form that has the focus
>>> Set ctrl = frm.ActiveControl
>>>
>>> 'if no text is selected in the control, then select all the text
>>> With ctrl
>>> If ctrl.SelLength = 0 Then
>>> ctrl.SelStart = 0
>>> ctrl.SelLength = Len(ctrl.Text)
>>> End If
>>> End With
>>>
>>> 'Run the spellchecker against the selected text
>>> ' DoCmd.RunCommand acCmdSpelling
>>> Application.RunCommand acCmdSpelling
>>>
>>> End Function
>>>
>>> Everything runs correctly, right up to the Runcommand acCmdSpelling, but
>>> when the code encounters that line, I get the following warning message.
>>> And, as you can see, I've tried both docmd.runcommand and
>>> application.runcommand, both result in the same error and Access
>>> shutdown.
>>>
>>> Microsoft Office Access has stopped working
>>>
>>> Windows can try to recover your information and restart the program.
>>>
>>> This most recent application involves a lot of long memo fields (on
>>> subforms) , and I would really like my users to be able to use the spell
>>> checker. Any help would be greatly appreciated.
>>>
>>>
>>> --
>>> HTH
>>> Dale
>>>
>>> email address is invalid
>>> Please reply to newsgroup only.
>>>
>>
>>
>
>


Re: Spell check still causing problems
"Dale Fye" <dale.fye[ at ]nospam.com> 12/13/2008 1:13:40 AM
Arvin,

My code runs fine against textboxes on the main form. But bombs when run in
a textbox on a subform.

When I open the form that is the source object for the subform, and run the
code there (as if it were a main form) it works just fine.

I have run into this problem at home and at work. Allen Browne mentioned a
couple of months ago that he would try to take a look at it, but that was
shortly after he started his new job, and I have not heard back from him.

I was hoping he or one of you MVPs would try to duplicate the problem, and
then bring it to the attention of the guys at Microsoft.

Have you actually tried to implement this in a subform in Office 2007?

Dale


"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
news:%23J8S9WBXJHA.1328[ at ]TK2MSFTNGP02.phx.gbl...
[Quoted Text]
> This the only code that is really active for spelling:
>
> DoCmd.RunCommand acCmdSpelling
>
> Try putting that in a function on the double-click event of 1 text box. If
> you get an error, It may be because you do not have your database in a
> Trusted location and have code enabled. It should run, and if this runs,
> everything else should as well.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
> news:eoxojeyWJHA.4768[ at ]TK2MSFTNGP04.phx.gbl...
>> Arvin,
>>
>> Tried it, but am still getting the same error and Access abort (mot much
>> difference between this and my code anyway, except looking at all
>> textboxes on the form, rather than only one).
>>
>> I've been having this problem ever since we moved to Office 2007, and it
>> has happened on each of the three computers I've had during that period.
>>
>> I've figured out that I can use F7 to do a spell check, and that seems to
>> work, although it appears to be doing it for every record in the main
>> table, rather than only the current record.
>>
>> Any other suggestion would be considered.
>>
>> Dale
>>
>>
>> "Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
>> news:%23Z3a$bvWJHA.4632[ at ]TK2MSFTNGP04.phx.gbl...
>>> Try this one. It's worked on all versions of Access in the last 11
>>> years:
>>>
>>> Public Function Spell()
>>> ' Arvin Meyer 9/17/1998
>>> ' Adapted from code by Terry Wickenden
>>> Dim ctlSpell As Control
>>> Dim frm As Form
>>> Set frm = Screen.ActiveForm
>>> 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
>>> End If
>>> End If
>>> Next
>>> DoCmd.SetWarnings True
>>> End Function
>>> --
>>> Arvin Meyer, MCP, MVP
>>> http://www.datastrat.com
>>> http://www.mvps.org/access
>>> http://www.accessmvp.com
>>>
>>>
>>> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
>>> news:0B8F0856-C642-4971-8296-3280088D7416[ at ]microsoft.com...
>>>> I'm still having spell check problems.
>>>>
>>>> I posted a note message to this board back in September, and never did
>>>> resolve the problem. I've worked on several other applications since
>>>> then,
>>>> and have never resolved the problem I'm having with a spellcheck
>>>> function
>>>> that I allow users to call via a shortcut menu. If they are in a
>>>> textbox on
>>>> the main form, the function appears to run successfully, but if the
>>>> control
>>>> that has the focus is on a subform, running this function causes Access
>>>> (2007) to lock up.
>>>>
>>>> Public Function fnTextSpell()
>>>>
>>>> Dim frm As Form
>>>> Dim ctrl As TextBox
>>>>
>>>> 'define the form that the popup was actually called from
>>>> Set frm = Screen.ActiveForm
>>>> While frm.ActiveControl.ControlType = 112
>>>> Set frm = frm.ActiveControl.Form
>>>> Wend
>>>>
>>>> 'Define the control on that form that has the focus
>>>> Set ctrl = frm.ActiveControl
>>>>
>>>> 'if no text is selected in the control, then select all the text
>>>> With ctrl
>>>> If ctrl.SelLength = 0 Then
>>>> ctrl.SelStart = 0
>>>> ctrl.SelLength = Len(ctrl.Text)
>>>> End If
>>>> End With
>>>>
>>>> 'Run the spellchecker against the selected text
>>>> ' DoCmd.RunCommand acCmdSpelling
>>>> Application.RunCommand acCmdSpelling
>>>>
>>>> End Function
>>>>
>>>> Everything runs correctly, right up to the Runcommand acCmdSpelling,
>>>> but
>>>> when the code encounters that line, I get the following warning
>>>> message.
>>>> And, as you can see, I've tried both docmd.runcommand and
>>>> application.runcommand, both result in the same error and Access
>>>> shutdown.
>>>>
>>>> Microsoft Office Access has stopped working
>>>>
>>>> Windows can try to recover your information and restart the program.
>>>>
>>>> This most recent application involves a lot of long memo fields (on
>>>> subforms) , and I would really like my users to be able to use the
>>>> spell
>>>> checker. Any help would be greatly appreciated.
>>>>
>>>>
>>>> --
>>>> HTH
>>>> Dale
>>>>
>>>> email address is invalid
>>>> Please reply to newsgroup only.
>>>>
>>>
>>>
>>
>>
>
>


Re: Spell check still causing problems
"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> 12/13/2008 2:40:39 PM
I think I see what the problem is. Screen.ActiveForm refers to the main
form. The subform is a mere control on the main form, a picture box, if you
will. You must refer to the Form property of the subform control. So, I'm
not sure that you can run this code from a module. Try running it from
inside the subform as a function. You can do that like:

Private Sub cmdSpell_Click()
Dim ctlSpell As Control
DoCmd.SetWarnings False
' Enumerate Controls collection.
For Each ctlSpell In Me.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
End If
End If
Next
DoCmd.SetWarnings True
End Sub

which was the original code I wrote 10 years ago, before I converted it to a
standard module.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
news:uFwE9DMXJHA.5980[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Arvin,
>
> My code runs fine against textboxes on the main form. But bombs when run
> in a textbox on a subform.
>
> When I open the form that is the source object for the subform, and run
> the code there (as if it were a main form) it works just fine.
>
> I have run into this problem at home and at work. Allen Browne mentioned
> a couple of months ago that he would try to take a look at it, but that
> was shortly after he started his new job, and I have not heard back from
> him.
>
> I was hoping he or one of you MVPs would try to duplicate the problem, and
> then bring it to the attention of the guys at Microsoft.
>
> Have you actually tried to implement this in a subform in Office 2007?
>
> Dale
>
>
> "Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
> news:%23J8S9WBXJHA.1328[ at ]TK2MSFTNGP02.phx.gbl...
>> This the only code that is really active for spelling:
>>
>> DoCmd.RunCommand acCmdSpelling
>>
>> Try putting that in a function on the double-click event of 1 text box.
>> If you get an error, It may be because you do not have your database in a
>> Trusted location and have code enabled. It should run, and if this runs,
>> everything else should as well.
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
>> news:eoxojeyWJHA.4768[ at ]TK2MSFTNGP04.phx.gbl...
>>> Arvin,
>>>
>>> Tried it, but am still getting the same error and Access abort (mot much
>>> difference between this and my code anyway, except looking at all
>>> textboxes on the form, rather than only one).
>>>
>>> I've been having this problem ever since we moved to Office 2007, and it
>>> has happened on each of the three computers I've had during that period.
>>>
>>> I've figured out that I can use F7 to do a spell check, and that seems
>>> to work, although it appears to be doing it for every record in the main
>>> table, rather than only the current record.
>>>
>>> Any other suggestion would be considered.
>>>
>>> Dale
>>>
>>>
>>> "Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
>>> news:%23Z3a$bvWJHA.4632[ at ]TK2MSFTNGP04.phx.gbl...
>>>> Try this one. It's worked on all versions of Access in the last 11
>>>> years:
>>>>
>>>> Public Function Spell()
>>>> ' Arvin Meyer 9/17/1998
>>>> ' Adapted from code by Terry Wickenden
>>>> Dim ctlSpell As Control
>>>> Dim frm As Form
>>>> Set frm = Screen.ActiveForm
>>>> 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
>>>> End If
>>>> End If
>>>> Next
>>>> DoCmd.SetWarnings True
>>>> End Function
>>>> --
>>>> Arvin Meyer, MCP, MVP
>>>> http://www.datastrat.com
>>>> http://www.mvps.org/access
>>>> http://www.accessmvp.com
>>>>
>>>>
>>>> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
>>>> news:0B8F0856-C642-4971-8296-3280088D7416[ at ]microsoft.com...
>>>>> I'm still having spell check problems.
>>>>>
>>>>> I posted a note message to this board back in September, and never did
>>>>> resolve the problem. I've worked on several other applications since
>>>>> then,
>>>>> and have never resolved the problem I'm having with a spellcheck
>>>>> function
>>>>> that I allow users to call via a shortcut menu. If they are in a
>>>>> textbox on
>>>>> the main form, the function appears to run successfully, but if the
>>>>> control
>>>>> that has the focus is on a subform, running this function causes
>>>>> Access
>>>>> (2007) to lock up.
>>>>>
>>>>> Public Function fnTextSpell()
>>>>>
>>>>> Dim frm As Form
>>>>> Dim ctrl As TextBox
>>>>>
>>>>> 'define the form that the popup was actually called from
>>>>> Set frm = Screen.ActiveForm
>>>>> While frm.ActiveControl.ControlType = 112
>>>>> Set frm = frm.ActiveControl.Form
>>>>> Wend
>>>>>
>>>>> 'Define the control on that form that has the focus
>>>>> Set ctrl = frm.ActiveControl
>>>>>
>>>>> 'if no text is selected in the control, then select all the text
>>>>> With ctrl
>>>>> If ctrl.SelLength = 0 Then
>>>>> ctrl.SelStart = 0
>>>>> ctrl.SelLength = Len(ctrl.Text)
>>>>> End If
>>>>> End With
>>>>>
>>>>> 'Run the spellchecker against the selected text
>>>>> ' DoCmd.RunCommand acCmdSpelling
>>>>> Application.RunCommand acCmdSpelling
>>>>>
>>>>> End Function
>>>>>
>>>>> Everything runs correctly, right up to the Runcommand acCmdSpelling,
>>>>> but
>>>>> when the code encounters that line, I get the following warning
>>>>> message.
>>>>> And, as you can see, I've tried both docmd.runcommand and
>>>>> application.runcommand, both result in the same error and Access
>>>>> shutdown.
>>>>>
>>>>> Microsoft Office Access has stopped working
>>>>>
>>>>> Windows can try to recover your information and restart the program.
>>>>>
>>>>> This most recent application involves a lot of long memo fields (on
>>>>> subforms) , and I would really like my users to be able to use the
>>>>> spell
>>>>> checker. Any help would be greatly appreciated.
>>>>>
>>>>>
>>>>> --
>>>>> HTH
>>>>> Dale
>>>>>
>>>>> email address is invalid
>>>>> Please reply to newsgroup only.
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Re: Spell check still causing problems
"Dale Fye" <dale.fye[ at ]nospam.com> 12/13/2008 10:06:17 PM
Arvin,

I know I can add that code into the form, but wanted to eliminate all of
that redundant code (having spell check code imbedded in every form seems
like a real waste of code). My textbox shortcut menu contains all of the
starnard (Copy, Cut, Paste) as well as Spell Check and Find options. Each
of these options runs a custom function or subroutine that is located in my
MenuFunctions code module. All of these other functions work when dealing
with subforms, but not the spell check.

I thought that these lines:

Set frm = Screen.ActiveForm
While frm.ActiveControl.ControlType = 112
Set frm = frm.ActiveControl.Form
Wend

Would take care of that. As long as the "ActiveControl" is a subform, I keep
drilling down, redefining the frm variable as the active control, and then
tacking on the .Form suffix. This seems to work, because the succeeding
lines

'Define the control on that form that has the focus
Set ctrl = frm.ActiveControl

'if no text is selected in the control, then select all the text
With ctrl
If ctrl.SelLength = 0 Then
ctrl.SelStart = 0
ctrl.SelLength = Len(ctrl.Text)
End If
End With

that define the textbox that is the actual control that has the focus works
when it highlights all of the text in the box if none is already highlighted
works fine.

Still confused.

Dale

"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
news:OofMGDTXJHA.556[ at ]TK2MSFTNGP06.phx.gbl...
[Quoted Text]
>I think I see what the problem is. Screen.ActiveForm refers to the main
>form. The subform is a mere control on the main form, a picture box, if you
>will. You must refer to the Form property of the subform control. So, I'm
>not sure that you can run this code from a module. Try running it from
>inside the subform as a function. You can do that like:
>
> Private Sub cmdSpell_Click()
> Dim ctlSpell As Control
> DoCmd.SetWarnings False
> ' Enumerate Controls collection.
> For Each ctlSpell In Me.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
> End If
> End If
> Next
> DoCmd.SetWarnings True
> End Sub
>
> which was the original code I wrote 10 years ago, before I converted it to
> a standard module.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>
> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
> news:uFwE9DMXJHA.5980[ at ]TK2MSFTNGP04.phx.gbl...
>> Arvin,
>>
>> My code runs fine against textboxes on the main form. But bombs when run
>> in a textbox on a subform.
>>
>> When I open the form that is the source object for the subform, and run
>> the code there (as if it were a main form) it works just fine.
>>
>> I have run into this problem at home and at work. Allen Browne mentioned
>> a couple of months ago that he would try to take a look at it, but that
>> was shortly after he started his new job, and I have not heard back from
>> him.
>>
>> I was hoping he or one of you MVPs would try to duplicate the problem,
>> and then bring it to the attention of the guys at Microsoft.
>>
>> Have you actually tried to implement this in a subform in Office 2007?
>>
>> Dale
>>
>>
>> "Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
>> news:%23J8S9WBXJHA.1328[ at ]TK2MSFTNGP02.phx.gbl...
>>> This the only code that is really active for spelling:
>>>
>>> DoCmd.RunCommand acCmdSpelling
>>>
>>> Try putting that in a function on the double-click event of 1 text box.
>>> If you get an error, It may be because you do not have your database in
>>> a Trusted location and have code enabled. It should run, and if this
>>> runs, everything else should as well.
>>> --
>>> Arvin Meyer, MCP, MVP
>>> http://www.datastrat.com
>>> http://www.mvps.org/access
>>> http://www.accessmvp.com
>>>
>>> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
>>> news:eoxojeyWJHA.4768[ at ]TK2MSFTNGP04.phx.gbl...
>>>> Arvin,
>>>>
>>>> Tried it, but am still getting the same error and Access abort (mot
>>>> much difference between this and my code anyway, except looking at all
>>>> textboxes on the form, rather than only one).
>>>>
>>>> I've been having this problem ever since we moved to Office 2007, and
>>>> it has happened on each of the three computers I've had during that
>>>> period.
>>>>
>>>> I've figured out that I can use F7 to do a spell check, and that seems
>>>> to work, although it appears to be doing it for every record in the
>>>> main table, rather than only the current record.
>>>>
>>>> Any other suggestion would be considered.
>>>>
>>>> Dale
>>>>
>>>>
>>>> "Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
>>>> news:%23Z3a$bvWJHA.4632[ at ]TK2MSFTNGP04.phx.gbl...
>>>>> Try this one. It's worked on all versions of Access in the last 11
>>>>> years:
>>>>>
>>>>> Public Function Spell()
>>>>> ' Arvin Meyer 9/17/1998
>>>>> ' Adapted from code by Terry Wickenden
>>>>> Dim ctlSpell As Control
>>>>> Dim frm As Form
>>>>> Set frm = Screen.ActiveForm
>>>>> 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
>>>>> End If
>>>>> End If
>>>>> Next
>>>>> DoCmd.SetWarnings True
>>>>> End Function
>>>>> --
>>>>> Arvin Meyer, MCP, MVP
>>>>> http://www.datastrat.com
>>>>> http://www.mvps.org/access
>>>>> http://www.accessmvp.com
>>>>>
>>>>>
>>>>> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
>>>>> news:0B8F0856-C642-4971-8296-3280088D7416[ at ]microsoft.com...
>>>>>> I'm still having spell check problems.
>>>>>>
>>>>>> I posted a note message to this board back in September, and never
>>>>>> did
>>>>>> resolve the problem. I've worked on several other applications since
>>>>>> then,
>>>>>> and have never resolved the problem I'm having with a spellcheck
>>>>>> function
>>>>>> that I allow users to call via a shortcut menu. If they are in a
>>>>>> textbox on
>>>>>> the main form, the function appears to run successfully, but if the
>>>>>> control
>>>>>> that has the focus is on a subform, running this function causes
>>>>>> Access
>>>>>> (2007) to lock up.
>>>>>>
>>>>>> Public Function fnTextSpell()
>>>>>>
>>>>>> Dim frm As Form
>>>>>> Dim ctrl As TextBox
>>>>>>
>>>>>> 'define the form that the popup was actually called from
>>>>>> Set frm = Screen.ActiveForm
>>>>>> While frm.ActiveControl.ControlType = 112
>>>>>> Set frm = frm.ActiveControl.Form
>>>>>> Wend
>>>>>>
>>>>>> 'Define the control on that form that has the focus
>>>>>> Set ctrl = frm.ActiveControl
>>>>>>
>>>>>> 'if no text is selected in the control, then select all the text
>>>>>> With ctrl
>>>>>> If ctrl.SelLength = 0 Then
>>>>>> ctrl.SelStart = 0
>>>>>> ctrl.SelLength = Len(ctrl.Text)
>>>>>> End If
>>>>>> End With
>>>>>>
>>>>>> 'Run the spellchecker against the selected text
>>>>>> ' DoCmd.RunCommand acCmdSpelling
>>>>>> Application.RunCommand acCmdSpelling
>>>>>>
>>>>>> End Function
>>>>>>
>>>>>> Everything runs correctly, right up to the Runcommand acCmdSpelling,
>>>>>> but
>>>>>> when the code encounters that line, I get the following warning
>>>>>> message.
>>>>>> And, as you can see, I've tried both docmd.runcommand and
>>>>>> application.runcommand, both result in the same error and Access
>>>>>> shutdown.
>>>>>>
>>>>>> Microsoft Office Access has stopped working
>>>>>>
>>>>>> Windows can try to recover your information and restart the program.
>>>>>>
>>>>>> This most recent application involves a lot of long memo fields (on
>>>>>> subforms) , and I would really like my users to be able to use the
>>>>>> spell
>>>>>> checker. Any help would be greatly appreciated.
>>>>>>
>>>>>>
>>>>>> --
>>>>>> HTH
>>>>>> Dale
>>>>>>
>>>>>> email address is invalid
>>>>>> Please reply to newsgroup only.
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Re: Spell check still causing problems
"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> 12/14/2008 6:37:21 PM

"Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
news:ezXi6$WXJHA.5272[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Arvin,
>
> I know I can add that code into the form, but wanted to eliminate all of
> that redundant code (having spell check code imbedded in every form seems
> like a real waste of code). My textbox shortcut menu contains all of the
> starnard (Copy, Cut, Paste) as well as Spell Check and Find options. Each
> of these options runs a custom function or subroutine that is located in
> my MenuFunctions code module. All of these other functions work when
> dealing with subforms, but not the spell check.
>
>
> Still confused.

I think Access may be confused as well. It may well be that the only way to
achieve success is to put the code inside the subform. Sometimes we need to
take a well travelled path, instead of trying to forge a new road.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Re: Spell check still causing problems
"Dale Fye" <dale.fye[ at ]nospam.com> 12/14/2008 6:40:19 PM
Arvin,

Thanks for your input. I'll continue to pursue this, but will, at least for
the time being, settle on your solution.

Dale

"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
news:ekM9BshXJHA.1532[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
>
> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
> news:ezXi6$WXJHA.5272[ at ]TK2MSFTNGP04.phx.gbl...
>> Arvin,
>>
>> I know I can add that code into the form, but wanted to eliminate all of
>> that redundant code (having spell check code imbedded in every form seems
>> like a real waste of code). My textbox shortcut menu contains all of the
>> starnard (Copy, Cut, Paste) as well as Spell Check and Find options.
>> Each of these options runs a custom function or subroutine that is
>> located in my MenuFunctions code module. All of these other functions
>> work when dealing with subforms, but not the spell check.
>>
>>
>> Still confused.
>
> I think Access may be confused as well. It may well be that the only way
> to achieve success is to put the code inside the subform. Sometimes we
> need to take a well travelled path, instead of trying to forge a new road.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>


Re: Spell check still causing problems
"Dale Fye" <dale.fye[ at ]nospam.com> 12/16/2008 1:56:32 AM
Arvin,

I just tested this again at home (where I have 2002, 2003, and 2007 all
running on the same box).

I created a simple Access 2003 application (two tables), two forms (form and
subform), and copied my menu and spell check funtion into the database.

The code runs flawlessly in 2003 (both in the main form, and the subform).

When I created a new mdb in 2007, and imported the tables, forms, and code
into that database, it locked up as soon as I tried to run the code from the
subform. Same thing happened when I created a new accdb from scracth and
imported the tables, forms and code.

This is a BUG, that needs to be addressed to the folks at MS.

Hope you will pass this on!


"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
news:ekM9BshXJHA.1532[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
>
> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
> news:ezXi6$WXJHA.5272[ at ]TK2MSFTNGP04.phx.gbl...
>> Arvin,
>>
>> I know I can add that code into the form, but wanted to eliminate all of
>> that redundant code (having spell check code imbedded in every form seems
>> like a real waste of code). My textbox shortcut menu contains all of the
>> starnard (Copy, Cut, Paste) as well as Spell Check and Find options.
>> Each of these options runs a custom function or subroutine that is
>> located in my MenuFunctions code module. All of these other functions
>> work when dealing with subforms, but not the spell check.
>>
>>
>> Still confused.
>
> I think Access may be confused as well. It may well be that the only way
> to achieve success is to put the code inside the subform. Sometimes we
> need to take a well travelled path, instead of trying to forge a new road.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>


Re: Spell check still causing problems
"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> 12/17/2008 2:48:35 AM
Sure will.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
news:O23e7JyXJHA.5272[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Arvin,
>
> I just tested this again at home (where I have 2002, 2003, and 2007 all
> running on the same box).
>
> I created a simple Access 2003 application (two tables), two forms (form
> and subform), and copied my menu and spell check funtion into the
> database.
>
> The code runs flawlessly in 2003 (both in the main form, and the subform).
>
> When I created a new mdb in 2007, and imported the tables, forms, and code
> into that database, it locked up as soon as I tried to run the code from
> the subform. Same thing happened when I created a new accdb from scracth
> and imported the tables, forms and code.
>
> This is a BUG, that needs to be addressed to the folks at MS.
>
> Hope you will pass this on!
>
>
> "Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> wrote in message
> news:ekM9BshXJHA.1532[ at ]TK2MSFTNGP03.phx.gbl...
>>
>> "Dale Fye" <dale.fye[ at ]nospam.com> wrote in message
>> news:ezXi6$WXJHA.5272[ at ]TK2MSFTNGP04.phx.gbl...
>>> Arvin,
>>>
>>> I know I can add that code into the form, but wanted to eliminate all of
>>> that redundant code (having spell check code imbedded in every form
>>> seems like a real waste of code). My textbox shortcut menu contains all
>>> of the starnard (Copy, Cut, Paste) as well as Spell Check and Find
>>> options. Each of these options runs a custom function or subroutine that
>>> is located in my MenuFunctions code module. All of these other
>>> functions work when dealing with subforms, but not the spell check.
>>>
>>>
>>> Still confused.
>>
>> I think Access may be confused as well. It may well be that the only way
>> to achieve success is to put the code inside the subform. Sometimes we
>> need to take a well travelled path, instead of trying to forge a new
>> road.
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>>
>
>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net