Message Box when editing existing record

Kozbot

Registered User.
Local time
Today, 05:38
Joined
Jan 16, 2013
Messages
110
Hello

What event would I attach code to, to have a message box pop up warning the user when that he is editing existing records.

I would like the message to appear not as the form loads, or as he tabs to the first control, but right as he makes any changes to the data displayed. Preferably the box should have a "OK" to continue the edit and a "Cancel" to undo it.

Thank you!
 
on form's OnChange or Change event, I don't remember precisely.
 
You should place it in the On Dirty event.
 
Try this:

Code:
Private Sub Form_Dirty(Cancel As Integer)

 Dim Resp As Integer

  If Not Me.NewRecord Then

   Resp = MsgBox("You Are Editing an Existing Record!" & vbNewLine & vbNewLine & "Hit <Cancel> to Undo This Edit", vbOKCancel + vbDefaultButton1, "Editing Existing Record!!!")
   
   Select Case Resp

    Case vbOK
    
    ' Do nothing; Allow Editing of Existing Record

    Case vbCancel
    
    Cancel = True ' Cancel the Edit  
   End Select

End If

End Sub
Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom