Using MS Access/Alert in a Form


good day,
i have a form with 3 fields CODE, ITEM, QUANTITY, and this fields are filled up with many data. I need to change the 3rd field (QUANTITY) every month leaving the other two's (CODE and ITEM) unchanged.
I need to set up an alert in these two fields (CODE and ITEM) whether by mistake i have changed it.
I tried with the following codes:

Private Sub Form_BeforeUpdate(Cancel As Integer)
   If MsgBox("Changes have been made to this record." _
       & vbCrLf & vbCrLf & "Do you want to save these changes?" _
       , vbYesNo, "Changes Made...") = vbYes Then
         DoCmd.RunCommand acCmdUndo
   End If

but they doesn't work in my form. Maybe i missed out some passages.

Instead of the UNDO command, just say:


That should cancel your changes.

Be sure to visit my web site and watch my FREE 2-hour-long Microsoft Access Video Tutorial

Richard Rost
599CD Computer Training  

Using MS Access

All Answers

Answers by Expert:

Ask Experts


Richard Rost


I am happy to answer any kinds of questions about Microsoft Access - from basic table design to advanced VBA programming. Also, please feel free to check the Access Tips & Tricks section of my web site, and free Access 101 tutorial.


I am the president of and I specialize in Microsoft Access Tutorials. I have been teaching Access in the classroom since 1994, and online since 2002.

I am a self-taught Access expert. I have been building databases for clients since the early 90s. You can see a sample of my Access Tutorials on my web site at

©2017 All rights reserved.

[an error occurred while processing this directive]