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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check spelling in 1 record only 9

Status
Not open for further replies.

rene1000

IS-IT--Management
Apr 9, 2002
89
0
0
NL
I have created a button which checks the spelling:

Private Sub button_spelling_Click()
SendKeys "{F7}"
end sub

this works but it starts checking all records in the table instead of only the required current record. Does anyone know how to limit the spell checking to the current record ?

Rene
 
Thank you very much wildhare, it works great but can you explain what this actually does and where can i find a list of doMenuItem options ?
 
I just stole that line out of the button that does a DUPLICATE RECORD action.

I have used spell check in the past, just don't have code examples closely at hand. I remember that I could get it to spell check just the field with the focus with a few lines of code. There is an acCommandCheckSpelling method that you might investigate that probably is a slightly more elegant way of doing it than SendKeys.

HTH

Jim



If at first you don't succeed, skydiving probably isn't for you!
Another free Access forum:
More Access stuff at
 
Hi,

I have tried the above code to perform a spell check. I can't seem to make it work for me. I have a memo field that I want to spell check, and I press the command button and I get the message "The spelling check is complete" but I have put in some mispellings just to check it but it doesnt seem to find them. I would appreciate any ideas.

Thanks
 
I just tested this with

Docmd.RunCmd acCmdSpelling

and it appears that MEMO type fields are not a valid object for spell checking - when I tried on a plain text field, it highlighted the misspelled words just fine.

Not sure what to suggest now - but there may be some third-party tools to do this - check with sites like FMS Inc. (
[hammer]

Jim




If at first you don't succeed, skydiving probably isn't for you!
Another free Access forum:
More Access stuff at
 
The spelling check works fine with me on a memo field so it is possible !
 
below is the code i have used:

Private Sub button_spelling_Click()
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
SendKeys "{F7}"
end sub

just like it says above and it perfectly checks the spelling in several memo fields in the current record.




 
Rene1K and others - Interesting. It appears (although I welcome being corrected) that the acCommandSpelling method does not work in MEMO type fields, but the SendKeys and keystroke {F7} for Spelling does - and since M/S isn't likely to change that key assignment anytime soon (it's the same key in all of Office), I suppose Rene's method should do fine.

J

If at first you don't succeed, skydiving probably isn't for you!
Another free Access forum:
More Access stuff at
 
I use Access 2002. I use the following in the afterupdate of a memo field and it works great.

DoCmd.SetWarnings False 'Turn off System Warning if spell check returns no error.
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdSpelling
DoCmd.SetWarnings True 'Turn back on the System Warnings
 
This is interesting - as Bock says, the Spell Check Works just fine, when called on the AFTER UPDATE event of the memo field. But when called as a button click event, it ignores the memo field (but DOES check any of the TEXT fields on the form)

I hesitate to call this a 'bug', but it probably qualifies as rather oddish behavior....

Have a stair, err, starr, ummm, stir, ahh..celestial object...



If at first you don't succeed, skydiving probably isn't for you!
Another free Access forum:
More Access stuff at
 
Besides checking one record: can we check one FIELD within a record?
I'm supervising a programmer, and writing this question for him. He tried Bocker's method above, in the afterupdate of a text field. Yes, it limited the check to one record. But we wanted to check only the one field, not the whole record.
It can't be that hard, can it? We just haven't found out how, yet
 
Hi there--working off of this post thread702-838959, I did this:

I put a button on the form, it will spell check only the text box "Field2". In the button's OnClick event, i put this. It loops thru all the controls, and if the control is a text box NOT named "Field2", it sets Enabled = False. It spell checks "Field2". Then it loops thru again and sets all items which are text boxes Enabled = True.

You can add combo boxes, and other controls as well.
Code:
Private Sub Command3_Click()
    Dim ctl As Control
    'disable all text boxes on form except for Field2
    For Each ctl In Me.Controls
        If ctl.Name = "Field2" Then
            ctl.Enabled = True
        Else
            If ctl.ControlType = acTextBox Then
                ctl.Enabled = False
            End If
        End If
    Next ctl

    'Set Focus to Field2
    Me.Field2.SetFocus

    'Start Spell Check
    DoCmd.RunCommand acCmdSpelling
    
   'Set all text boxes back to Enabled = True
    For Each ctl In Me.Controls
        If ctl.ControlType = acTextBox Then
            ctl.Enabled = True
        End If
    Next ctl

End Sub


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Ginger: it works great! One star for you!
Thanks,
Will
 
GingerR,

Impressive. I am somewhat enamored of 'generalization' of small procedures and tweaked yours to tend toward that goal.


Code:
Public Function basChkSpell(Ctrl As Control) As Boolean

    Dim Ctl
    'disable all text boxes on form except for Field2
    For Each Ctl In Ctrl.Parent.Controls
        If (Ctl.name = Ctrl.name) Then
            Ctl.Enabled = True
        Else
            If Ctl.ControlType = acTextBox Then
                Ctl.Enabled = False
            End If
        End If
    Next Ctl

    'Set Focus to Field2
    Ctrl.SetFocus

    'Start Spell Check
    DoCmd.RunCommand acCmdSpelling
    
   'Set all text boxes back to Enabled = True
    For Each Ctl In Ctrl.Parent.Controls
        If Ctl.ControlType = acTextBox Then
            Ctl.Enabled = True
        End If
    Next Ctl

End Function
[code]

MichaelRed
 
Side effect: previously disabled controls are enabled ...
 
I did notice that. Decided that, while important, it was not the thrust of the thread. Also, Easily overcome by just keeping a list (array) of controls whiere they are previously disabled and not enabling them in the return. I didn't have a a handy way to test (w/o more work so (lazily) ignored it.





MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top