Return value to original entry if Message fires.

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
 
A

Allen Browne

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
 
D

Don

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
 

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

Similar Threads


Top