473,320 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Function SpellCheck_Field()

cmd
Hi all,
A long time ago I picked up this spell check function which I use in
the OnExit event for particular fields. I apologize to the creator of
this function for not remembering their name.

The function works fine if I'm tabbing from one field to another, or
use a custom close button to exit the form. But on certain
form/subforms I get the following error message if I try to close the
form (and its subform) using the "X" control button:

Run-time error '2474'
The expression you entered requires the control to be in the active
window.
Try one of the following:
*Open or select a form or report containing the control.
*Create a new control in the active window, and try the opereation
again.
Debug ...... End

The function is as follows:

' Put the call to the function in the "OnExit"
' OR "LostFocus" event for the required field
' as: =SpellCheck_Field()
'
' Do NOT put it in the "AfterUpdate" event

'
----------------------------------------------------------------------
' Requires the following files:

' Spelling checker (Msp*.dll, Mssp*.dll, and Mssp*.lex files)
' Hyphenator (Mshy*.dll and Mshy*.lex files)
' Thesaurus (Msth*.dll and Msth*.lex files)
' Grammar dictionary (Msgr*.lex files)

' to exist in: Program Files\Common Files\Microsoft Shared\Proof folder
(which they should)

'
----------------------------------------------------------------------
Dim frm As Form
Set frm = Screen.ActiveControl.Parent

If frm.Dirty Then
frm.Dirty = False
End If
On Error Resume Next
Dim L As Integer
L = Nz(Len(Screen.ActiveControl), 0)
L = Len(Nz(Screen.ActiveControl, ""))
If L 0 Then
With Screen.ActiveControl
.SetFocus
.SelStart = 0
.SelLength = L
End With

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSpelling
DoCmd.SetWarnings True
End If

End Function

'************************

Question:
Is there something I should adjust to this function, or some other
change I should make to my forms/subforms to fix this problem? Some
form/subform combinations don't produce this error, others do and I
can't figure out the difference.

Appreciate any help,
Mark

Jul 22 '06 #1
2 2859
cmd
.... apologies ... I forgot to mention that it errors at the line:
Set frm = Screen.ActiveControl.Parent

c...@mountain.net wrote:
Hi all,
A long time ago I picked up this spell check function which I use in
the OnExit event for particular fields. I apologize to the creator of
this function for not remembering their name.

The function works fine if I'm tabbing from one field to another, or
use a custom close button to exit the form. But on certain
form/subforms I get the following error message if I try to close the
form (and its subform) using the "X" control button:

Run-time error '2474'
The expression you entered requires the control to be in the active
window.
Try one of the following:
*Open or select a form or report containing the control.
*Create a new control in the active window, and try the opereation
again.
Debug ...... End

The function is as follows:

' Put the call to the function in the "OnExit"
' OR "LostFocus" event for the required field
' as: =SpellCheck_Field()
'
' Do NOT put it in the "AfterUpdate" event

'
----------------------------------------------------------------------
' Requires the following files:

' Spelling checker (Msp*.dll, Mssp*.dll, and Mssp*.lex files)
' Hyphenator (Mshy*.dll and Mshy*.lex files)
' Thesaurus (Msth*.dll and Msth*.lex files)
' Grammar dictionary (Msgr*.lex files)

' to exist in: Program Files\Common Files\Microsoft Shared\Proof folder
(which they should)

'
----------------------------------------------------------------------
Dim frm As Form
Set frm = Screen.ActiveControl.Parent

If frm.Dirty Then
frm.Dirty = False
End If
On Error Resume Next
Dim L As Integer
L = Nz(Len(Screen.ActiveControl), 0)
L = Len(Nz(Screen.ActiveControl, ""))
If L 0 Then
With Screen.ActiveControl
.SetFocus
.SelStart = 0
.SelLength = L
End With

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSpelling
DoCmd.SetWarnings True
End If

End Function

'************************

Question:
Is there something I should adjust to this function, or some other
change I should make to my forms/subforms to fix this problem? Some
form/subform combinations don't produce this error, others do and I
can't figure out the difference.

Appreciate any help,
Mark
Jul 22 '06 #2
cmd
.... apologies ... I forgot to mention that it errors at the line:
Set frm = Screen.ActiveControl.Parent

c...@mountain.net wrote:
Hi all,
A long time ago I picked up this spell check function which I use in
the OnExit event for particular fields. I apologize to the creator of
this function for not remembering their name.

The function works fine if I'm tabbing from one field to another, or
use a custom close button to exit the form. But on certain
form/subforms I get the following error message if I try to close the
form (and its subform) using the "X" control button:

Run-time error '2474'
The expression you entered requires the control to be in the active
window.
Try one of the following:
*Open or select a form or report containing the control.
*Create a new control in the active window, and try the opereation
again.
Debug ...... End

The function is as follows:

' Put the call to the function in the "OnExit"
' OR "LostFocus" event for the required field
' as: =SpellCheck_Field()
'
' Do NOT put it in the "AfterUpdate" event

'
----------------------------------------------------------------------
' Requires the following files:

' Spelling checker (Msp*.dll, Mssp*.dll, and Mssp*.lex files)
' Hyphenator (Mshy*.dll and Mshy*.lex files)
' Thesaurus (Msth*.dll and Msth*.lex files)
' Grammar dictionary (Msgr*.lex files)

' to exist in: Program Files\Common Files\Microsoft Shared\Proof folder
(which they should)

'
----------------------------------------------------------------------
Dim frm As Form
Set frm = Screen.ActiveControl.Parent

If frm.Dirty Then
frm.Dirty = False
End If
On Error Resume Next
Dim L As Integer
L = Nz(Len(Screen.ActiveControl), 0)
L = Len(Nz(Screen.ActiveControl, ""))
If L 0 Then
With Screen.ActiveControl
.SetFocus
.SelStart = 0
.SelLength = L
End With

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSpelling
DoCmd.SetWarnings True
End If

End Function

'************************

Question:
Is there something I should adjust to this function, or some other
change I should make to my forms/subforms to fix this problem? Some
form/subform combinations don't produce this error, others do and I
can't figure out the difference.

Appreciate any help,
Mark
Jul 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
5
by: phil_gg04 | last post by:
Dear Javascript Experts, Opera seems to have different ideas about the visibility of Javascript functions than other browsers. For example, if I have this code: if (1==2) { function...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
2
by: sushil | last post by:
+1 #include<stdio.h> +2 #include <stdlib.h> +3 typedef struct +4 { +5 unsigned int PID; +6 unsigned int CID; +7 } T_ID; +8 +9 typedef unsigned int (*T_HANDLER)(void); +10
8
by: Olov Johansson | last post by:
I just found out that JavaScript 1.5 (I tested this with Firefox 1.0.7 and Konqueror 3.5) has support not only for standard function definitions, function expressions (lambdas) and Function...
3
by: Beta What | last post by:
Hello, I have a question about casting a function pointer. Say I want to make a generic module (say some ADT implementation) that requires a function pointer from the 'actual/other modules'...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
28
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
4
by: alex | last post by:
I am so confused with these three concept,who can explained it?thanks so much? e.g. var f= new Function("x", "y", "return x * y"); function f(x,y){ return x*y } var f=function(x,y){
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.