Return value to original entry if Message fires.

  • Thread starter Thread starter Don
  • Start date Start date
D

Don

In the Before Update event I am using the following code which is working
except if the Message fires, I want the field value to return to the original
value. Currently the message fires and the user presses Ok but the change
occurs and I need to stop it and return to the original value. The following
code is what I have. What do I need to add so it will work the way I intend?

Private Sub CboRate_Change(Cancel As Integer)
Dim strMessage As String
strMessage = "To qualify for this pay increase, Employee must have a GED or
High School Diploma. Verify Education then change GED-HS drop down menu to
reflect correct education status (GED/HS only to receive bonus)and try again,
otherwise bonus raise does not meet Payroll Policy and is denied."

If Me.GED_HSStatus <> 3 And Me.CboRate.Column(3) = 4 Then

MsgBox strMessage, vbExclamation, "No GED or HS Diploma No Bonus"
Cancel = True

End If
End Sub
 
Use the BeforeUpdate or AfterUpdate rather than the Change event.

This kind of thing:

Private Sub CboRate_AfterUpdate()
If ... Then
MsgBox ...
Me.cboRate.Undo
End If
End Sub
 
Allen, perfect!
--
Thanks,

Dennis


Allen Browne said:
Use the BeforeUpdate or AfterUpdate rather than the Change event.

This kind of thing:

Private Sub CboRate_AfterUpdate()
If ... Then
MsgBox ...
Me.cboRate.Undo
End If
End Sub
 
Back
Top