Results 1 to 3 of 3
  1. #1
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727

    Save Button with If Msgbox

    I have a save button with an "if msgbox". If the user clicks yes the save will go through. If the user clicks no then the record is undone. Instead of undoing the record, I would like to just keep the record dirty and prevent the save. Is this possible? Is it the cancel event or something? If so, how do you write that in VBA?



    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Post your button code.

    You need an If Then Else, like:

    If MsgBox("Do you really want to save record?", vbYesNo) = vbYes Then
    DoCmd.RunCommand acCmdSaveRecord
    End If

    Be sure to disable form X close and right click menu.
    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
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by June7 View Post
    Post your button code.

    You need an If Then Else, like:

    If MsgBox("Do you really want to save record?", vbYesNo) = vbYes Then
    DoCmd.RunCommand acCmdSaveRecord
    End If

    Be sure to disable form X close and right click menu.
    Thanks June7. I figured out to use the Cancel = True line to prevent the save where needed. Seems to be working the way I want. Thanks again.

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

Similar Threads

  1. Replies: 15
    Last Post: 03-07-2023, 01:43 PM
  2. Replies: 2
    Last Post: 11-13-2017, 08:51 AM
  3. Custom button captions msgbox
    By Ruegen in forum Access
    Replies: 2
    Last Post: 11-20-2013, 03:59 PM
  4. form - save entered data only with save button
    By cbrxxrider in forum Forms
    Replies: 3
    Last Post: 10-20-2013, 12:39 PM
  5. Replies: 3
    Last Post: 10-08-2012, 08:40 AM

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