Flag Up when an entry is made in a field.

D

Dishon

Can I, say automatically send a email, if a entry is made in a specific
field. ie if a user checks the urgent tick box?
 
A

Allen Browne

Access lacks triggers, so you cannot do this at the engine level. But if the
entries are made in forms, you can use the events of the form to achieve
this.

Use the AfterUpdate event of the form to examine your IsUrgent field. To
know if it changed, you need to look at the OldValue of the control, but
that's not available in Form_AfterUpdate, so you will need to use a
form-level variable and assign it in Form_BeforeUpdate.

1. In the General Declarations section of the form's module (at the top,
with the Option statements), add this line:
Dim bChangedToUrgent As Boolean

2. In the BeforeUpdate event of the form:
bChangedToUrgent = False
If Me.IsUrgent.OldValue Then
'do nothing
ElseIf (Me.IsUrgent.Value) Then
bChangedToUrgent = True
End If

3. In the AfterUpdate event of the form:
If bChangedToUrgent Then
DoCmd.SendObject acSendNoObject, ...
End If
 
Top