I am using this code to perform spell checks (not sure where I got it, but it works a peach): -
Public Function SpellChecker(Calling As Form)
-
On Error GoTo Err_SpellChecker
-
Dim ctlSpell As Control
-
Dim Incoming As String, Outgoing As String
-
-
DoCmd.SetWarnings False
-
-
Set ctlSpell = Calling.ActiveControl
-
If (ctlSpell.Locked) Then
-
Line1 = "Cannot spell check. Field is read-only"
-
mbResult = MsgBox("OK", "", "", Line1)
-
Else
-
-
If (ctlSpell) > 0 Then
-
Incoming = ctlSpell
-
With ctlSpell
-
.SetFocus
-
.SelStart = 0
-
.SelLength = Len(ctlSpell)
-
End With
-
DoCmd.RunCommand acCmdSpelling
-
Outgoing = ctlSpell
-
End If
-
' See if any changes were made 09/29/04
-
If (Incoming <> Outgoing) Then
-
' Notify user that changes
-
' were made, if you want to,
-
' or give Bronx cheer
-
End If
-
End If
-
-
DoCmd.SetWarnings True
-
-
exit_SpellChecker:
-
Exit Function
-
-
Err_SpellChecker:
-
Select Case Err.Number
-
Case 2424
-
'MsgBox "change rs"
-
Exit Function
-
Case 438
-
MsgBox "438 error"
-
Case Else
-
MsgBox Err.Number & "-" & Err.Description
-
Resume exit_SpellChecker
-
End Select
-
End Function
-
Setup:
The textboxes that are spell checked reside on a subform that has it's recordsource dynamically created by an option group on the parent form (criteria in query changes by the value of the option group button selected).
Problem:
If a textbox that has focus contains a misspelled word and the option group is clicked, ctlSpell does not exist and it throws a 2424 error. Strangely, I tested this in a textbox that contains properly spelled words and it works fine. No worries here but strange nonetheless.
Question:
Can I fire the spellcheck as part of the option group click event? So in effect the function could complete before the recordsource for the subform is changed. If this might work, how would I pass ctlSpell (the active control prior to clicking the option group) back to the function when the option group has already been clicked? Perhaps there is a better way but my limited knowledge of Access is tapped at the moment.
Thanks for looking and for providing any assistance you can.
3 3317 ADezii 8,834
Recognized Expert Expert - You can Declare a Global Object Variable as Type Control in a Standard Code Module, as in:
- Public gctlActiveControl As Control
- At some point prior to the Option Group Click, assign the Object Variable to the appropriate Control, as in:
- Set gctlActiveControl = Me![txtTest]
- You can then use the With...End With Structure in the traditional manner, as in:
- With gctlActiveControl
-
.SetFocus
-
'YaDa-YaDa
-
End With
Thanks for the quick response ADezii. One thing I failed to note is the textbox I wish to spell check resides in a continuous subform, so I think that means that there is only one textbox. I'll give your code a go.
Thanks again.
This seems to work in the on click event of the option group: -
sfrmResponses.SetFocus
-
DoCmd.SetWarnings False
-
DoCmd.RunCommand acCmdSpelling
-
DoCmd.SetWarnings True
-
Me.sfrmResponses.Form.RecordSource = "qsfrmSurveyResponses"
-
Me.TabCtl.Value = 1
-
I think I was overthinking it. I think.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jonathan W. Zaleski |
last post by:
I was wondering if such a plugin existed outside the Office Bundle, that
would preform a spell-check of an indicated field within a HTML Page.
|
by: eddie wang |
last post by:
Hello,
I inherited an Access application from a previous coworker. It seems
the Spell Check is never enabled unless I open the application by
holding down the shift key and double clicking the application icon at
the same time.
How can I enable the spell check all the time?
I saw some code posted by Terry Wickenden in this newsgroup.
unfortunately his code didn't work for me.
|
by: Cassie Pennington |
last post by:
Is there a command to spell check fields in Access (probably in the
afterupdate event)?
Thanks in anticipation
Cassie
|
by: Steve Jorgensen |
last post by:
There's this app I wrote a long time ago for a client who uses it to
administer the database content that drives their Web site. Last time I was
in there' I notices a lot of embarassing typos in the data, and since this
data is published on their Web site which is their primary interface to their
customers, that's a bad thing.
I was thinking it would be nice if I could automatically spell check certain
fields, and somehow use the Access...
|
by: Vish |
last post by:
Is there a way to implement Spell Check Functionality into WinForm (for the
text(s) contained/ entered in text box).
What are the best ways to implement spell checking in a WinForms application?
Thx.
| |
by: Ryan |
last post by:
Is there anyway to enable spell-checking for user input in a Text Box?
Either auto spell-check or create a spell-check button. Using VB 2005.
|
by: John Wright |
last post by:
I have a VB program that will be generating documentation that will be
stored for 60 years. This program really needs to have spell check and I
read the post below on using spell check. I was wondering if there was a
way to tap into the Word spell check that shows the underlined spelling
errors as the person types. If so, can someone point me to some code to
try? It would be really nice to show the errors as they type (like word
does)...
|
by: progvar |
last post by:
hi
i am getting probleum in converting a spell check progrma made in vb 6.0 and Ms-office Word into OpenOffice Word
when i made spell check program in Ms-Word and vb 6.0 it works fine
but i use the following code to make spell check program on OpenOffice and vb 6.0 it shows error "OBJECT REQUIRED" on line Set vReturn = vSpeller.SPELL(sWord, aLocale, args()) when correct spelling is stored in sWord variable
in previous program when a...
|
by: alnino |
last post by:
I have set up a form to autocomplete fields via comboboxes. Unfortunately, my vb code to spell check the current record will not check the comboboxes.
Is there a way to call the associated table and the current record, from this form, that will then spell check these fields that relate to the comboboxes?
This is the code for my spell check button on the form:
Private Sub Command18864_Click()
RunCommand acCmdSelectRecord
RunCommand...
|
by: alnino |
last post by:
Hi,
I currently have a form that uses combo boxes for user input. The combo boxes function as “autocomplete”. All works fine except for:
I have a command button to spell check the current form record. The spell check will not check any of the combo boxes.
Private Sub Command18864_Click()
RunCommand acCmdSelectRecord
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |