Confirm record changes on MS Access form

No replies
thinker
thinker's picture
User is online Online
Joined: 06/02/2008
Printer-friendly versionPrinter-friendly versionSend to friendSend to friendPDF versionPDF version

MS Access forms automatically saves the data you enter. Therefore, if you want to take an extra step to secure your database from unwanted corruption then here is the code that you may try:

*************************************************

Private Sub Form_BeforeUpdate(Cancel As Integer)

' This step is to confirm with user that this record is going to be modified

  Dim updRecord As Byte

  updRecord = MsgBox("Do you wish to change this record ?", vbOKCancel, "Record Modification")

  If updRecord = vbCancel Then

    Cancel = True

  End If

End Sub

**********************************

Are we being helpful? If so, please link to us here.