Results 1 to 3 of 3
  1. #1
    MintChipMadness is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    109

    Message Box to Confirm Update

    I want to create a message box that pops up when a control is updated. If the user selects yes, it will let them continue, if not, it will undo the changes and give another message box to say that the changes have been reversed. I started the If statement on the before update event (or would it be an On Dirty event?) below but I am doing something wrong. There isn't an error but it never lets me move away from the control if I select yes (keeps giving popup). It also doesn't undo the changes when I select no. I am sure I am doing something wrong. Does Cancel just remove the msg box? Should I do a me.undo in there?



    Code:
    Private Sub destroy_BeforeUpdate(Cancel As Integer)
    If MsgBox(Prompt:="Do you really want to update?", Buttons:=vbYesNo) = vbNo Then
    Cancel = True
    MsgBox "Update Canceled"
    End If
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    I think would need the Undo if want to allow user to leave the box without entering value or having to press ESC. Review http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    MintChipMadness is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    109
    Added the undo and it works perfectly. Thank you!!

    Working Code:
    Code:
    Private Sub destroy_BeforeUpdate(Cancel As Integer)
    If MsgBox(Prompt:="Do you really want to update?", Buttons:=vbYesNo) = vbNo Then
    Cancel = True
    Me.destroy.Undo
    MsgBox "Update Canceled"
    End If
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 07-20-2012, 05:22 PM
  2. Confirm Data Changes, Yes/No/Cancel
    By Subwind in forum Code Repository
    Replies: 6
    Last Post: 05-30-2012, 09:41 AM
  3. Help to confirm if a bug (or not).
    By 245 in forum Access
    Replies: 18
    Last Post: 01-15-2012, 07:50 PM
  4. Confirm Changes in a Query
    By 161 in forum Queries
    Replies: 6
    Last Post: 03-11-2011, 10:51 AM
  5. Replies: 1
    Last Post: 01-22-2011, 12:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums