Event when spell check makes a change?

C

cmk7471

I'm using an ODBC connection to our business system to spell check product
descriptions for our online catalog. I'm using a form to view the data in the
business system. When spell check makes a change to a description I would
like the ChangeDate field for that description to be updated to the current
date. I tried OnDirty, OnChange, AfterUpdate and none of them seem to occur
when spell check makes a change.

Thanks!
 
A

Arvin Meyer [MVP]

Event's don't fire in response to code, so you'll have to add the Code to
the control or form AfterUpdate event, along with the spell check. You can
do the spell checking in code as well:

Public Function Spell()
' Arvin Meyer 9/17/1998
' Adapted from code by Terry Wickenden
Dim ctlSpell As Control
Dim frm As Form
Set frm = Screen.ActiveForm
DoCmd.SetWarnings False
' Enumerate Controls collection.
For Each ctlSpell In frm.Controls
If TypeOf ctlSpell Is TextBox Then
If Len(ctlSpell) > 0 Then
With ctlSpell
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
Next
DoCmd.SetWarnings True
End Function
 
C

cmk7471

I think it may be simpler than that. I only have to spell check one text box
for each record so I don't need to examine all the controls. The user is
running spell check from the menu or <F7>, so I'm not using any code to run
spell check. I want the user to choose whether to change or ignore each item
found by spell check. I just want to update the ChangeDate field for the
record if spell check makes a change to that description. I don't know if it
makes a difference, but I am using a continuous form to see multiple records
at once. I tried using the AfterUpdate, Dirty, and Change events for the text
box that spell check is changing but it seems those events aren't being
triggered by the spell check. Here's an example of the code I put in the text
box's event.

Private Sub ITC_DESC_AfterUpdate()
ITC_CHG_DATE = Date
End Sub
 
A

Arvin Meyer [MVP]

Date stamping a record should ***always*** be done in the
Form_BeforeUpdate
event! This event will ***always*** fire when a change has been made to
the
data, regardless of how that change was made, and the record is saved,
thru
moving to a new record, closing the form, or an explicit save. If spell
check
is run and no change is made, Form_BeforeUpdate will not fire and the date
stamp won't change.

I prefer to alter data after a change is made. I use BeforeUpdate to write
to other fields, like adding a username and datestamp to a record before
saving it. Using BeforeUpdate is usually safe, but it is possible to stick
yourself in an endless loop from which a Ctl+Alt+Del is the only way to
extricate oneself.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top