Send message when a change has been made to a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a scroll box on a form with a list of dates. I want a message (ex:
"Date has been changed") to appear every time the user changes the date shown
in the scroll box. I have the code in the "On Change" property, however this
message appears even when the user initially selects the date in a new record
which I do not want. I only want the message to appear if the value changes
from an existing record not on a new record. Is this possible?
 
Hi,


In the BeforeUpdate event of the CONTROL (NOT of the FORM).


If Me.NewRecord then
'ok as it is, it is a new record
ElseIf Me.ControlName.OldValue = Me.ControlName.Value then
'ok as it is, it is an old record, but the value is unchanged
Else
MsgBox "date changed (not saved yet)"
End If




Note that the value will be saved in the table ONLY AFTER the FORM before
update will occur, without problem. The OldValue property returns the last
saved value, in the table, for each control "bound" to a field. The Value
property returns the actual (modified or not) value exposed through the user
interface... and, again, may not be "saved" yet, in the table.


Hoping it may help,
Vanderghast, Access MVP
 
Back
Top