Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Check Spelling < First Day of Year | After Update >
Back to Check Spelling    Comments List
Upload Images   Link   Email  
Logging Spelling Errors
Gary Marks 
    
3 years ago
This may not be possible, but I had a request for the following, if someone out there has any ideas on how (or if) this can be done with the native spell check feature described in this video:

Is there a programmatic way to spell check all the entries of a field in a table and automatically skip any spelling errors (so it goes through each record for that field without stopping) but then logs any words it thought were misspelled (and the ID of the record it was in) to another table for review?

Thanks for any thoughts!
Kevin Yip 
     
3 years ago
Excel has a function called CheckSpelling(word) that returns true if the word is spelled correctly, or false otherwise.  Access doesn't have this feature, but thanks to automation, Access can use it like any other feature.

See picture below.  First you need to add the Excel Object Library to the list of "references" in the Access VBA editor.  Then you create a custom function MySpellCheck, as shown, that calls the built-in Excel function CheckSpelling().  Basically, Access "declares" a new instance of the Excel application, and grabs a function from Excel as if it were its own.  

Then you can use your custom function anywhere you want, in queries or other VBA procedures.

One caveat is that if there are multiple words, the CheckSpelling() function returns false if ANY one of the words is misspelled, and doesn't tell you which one.  If you need it to work for individual words, you need to split up any multi-word string into individual words, with the VBA function Split().  For instance:

Dim arr As Variant
arr = Split("This is a test.", " ")

"arr" is an array variable, and the above yields: arr(0) = "This", arr(1) = "is", arr(2) = "a", arr(3) = "test."

And finally, to achieve your end goal, you need to run a query to put misspelled words into a table, with DoCmd.RunSql or CurrentDB.Execute.

This is not a terribly difficult problem, mainly because of how easy it is for Access to grab the spellcheck function from Excel.  But you do need skills and knowledge from several areas: automation, VBA, Split(), arrays, queries, DoCmd.RunSQL, CurrentDB.Execute, etc.  Hopefully the other posters could steer you to the right courses if you need them.
Kevin Yip 
     
3 years ago

Gary Marks OP 
    
3 years ago
Thank you Kevin!! This is great stuff!  I do have long text fields, so not sure if splitting them into many, many individual word fields makes sense, but would love any other thoughts anyone has on a way to make this work in a workable way.
Thanks again!
Kevin Yip 
     
3 years ago
You don't need to split them into fields; your table structures and data aren't affected at all.  You just split them, and store them into an array variable ("arr" in my sample code above), and use VBA to check the words in that variable for misspelled words.  Sample code:

Dim arr As Variant, n As Long, i As Long
arr = Split(MyLongText, " ")
n = UBound(arr)    ' n = number of words minus 1
For i = 0 To n
     If MySpellCheck(arr(i)) = False Then DoSomething
Next i

To log a misspelled word, a simple append query to another table would do it.  That table would need to be a child table in a one-to-many relationship, because each of your long text field could have many misspelled words.  This site has several videos on append queries and one-to-many relationships.
Gary Marks OP 
    
3 years ago
Thank you and thank you!  This seems doable.  Really nice clear instructional help :-)
Best,
Gary

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Check Spelling.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 3/23/2025 5:52:47 PM. PLT: 1s