Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Access VBA SpellCheck in Tables

Status
Not open for further replies.
Jun 10, 2011
4
US
Hi, all. I've never done this before, but I cannot find the answer in google results as I have so many times before, so this is my last option. UPDATE: I've already posted this in another section of the site, but someone suggested I post here instead. Sorry about the duplicate posting.

I'm currently interning with a company who has hired me to help automate office processes centered around databases. So far, I've done things with access, excel, and VBA that I didn't even think was possible, but for some reason, I've now hit a brick wall.

The task seems deceptively simple: We are importing data from a project management database into access. Sometimes, fields such as project description or project title will have records that come in with spelling errors. Instead of meticulously reading these, or copying and pasting them into microsoft word one record at a time, what we would like to do is be able to cycle through the records belonging to a particular field and spellcheck them while they're in the table and then highlight the misspelled word in some way.

Right now, I have a solution that uses my own list of words and in a loop, compares the data in a single field such as recSet![Project Description] to the list of words. Unfortunately, my code considers all the data in the field one word, and obviously never finds a match, which is not sufficient. Another problem lies in the fact that this database usually has at least 3,000 records in it so the solution that I have right now, in addition to not working properly, is also very slow, which discourages me from trying to tweak it. Any advice whatsoever would be appreciated. Thanks in advance.
 
It’s been a while, so I take a stab at it. Here’s the way I allow a user to check spelling in the remarks of an inspection checklist.

I set focus to the text box holding the remarks. The control source is a field from a table. When the user clicks the “Check Spelling” button, I run DoCMd.RunMacro “SpellChecker”. The macro “SpellChecker” has an Action of “RunCommand” and the Command is “Spelling”. This has worked well for years.

Maybe you can import the data to spell checking into a special field and check spelling there. There may be a better/faster way. But this should get you started.

Tom
 
build a simple continous form and like has already been said you can run the speller macro or the following code

someControl.setfocus
DoCmd.RunCommand acCmdSpelling

If you have several columns on your form that you would like to spell check then have code that first sets the focus to the field you want spell checked. It will check every record in that column.

Did you say you want to only highlight the possible error and not fix it?

The only way I think I could do that would be to copy the data into another field. Run the spell checker on that field. Then hilite in the original field the difference. That field would have to be rich text (Access 2007 and beyond only) to allow highlight of the field. Somewhat complicated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top