Results 1 to 5 of 5
  1. #1
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727

    Pop Message Box Warning

    I wanted to make a pop up message box that warns the user if they make a change to an existing record it asks them if they are sure they want to change 1234 to 5678 (for example). If they click yes, then it will keep the changes. If they click no, it goes back to what it was. I want it for the entire form. If a new record is being entered then I do not want this message box to show up. Does anyone know the code for this? Can I just put the code in before update event?

  2. #2
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727
    I found this code but I get a compile error. I copied it from a forum so I don't know if I have to edit some of the code to fit my form. Here it is:

    Private Sub Form_BeforeUpdate(Cancel As Integer)

    'confirm with user that this record is to be modified

    Dim updRecord As Byte

    On Error GoTo Form_BeforeUpdate_Error

    updRecord = MsgBox("Confirm record change", vbOKCancel, "Record
    Modification ")"

    If updRecord = vbCancel Then
    Cancel = True

    End If

    'Dim priordate As Variant
    'Dim prioruser As Variant
    Me!DateModified = Now()
    Me!UserModified = CurrentUser()

    On Error GoTo 0
    Exit Sub

    Form_BeforeUpdate_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in"
    procedure Form_BeforeUpdate of VBA Document Form_Customers"
    End Sub

  3. #3
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    What is the error on what line?

    This is Form "BeforeUpdate" event code based on the sub name.

    If you don't have this two created ("DateModified" and "UserModified") on the form will cause error.

    And change this MsgBox line to this
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_BeforeUpdate of VBA Document Form_Customers"

  4. #4
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727
    Found another code that works but I need some help on it. I'll later today. Thanks.

  5. #5
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727
    Never mind. The one I found seems to work. Thanks very much for your help anyway.

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

Similar Threads

  1. Access Warning Message
    By marksnwv in forum Access
    Replies: 1
    Last Post: 06-01-2012, 01:46 PM
  2. remove Macro Warning message
    By Jerseynjphillypa in forum Programming
    Replies: 3
    Last Post: 05-09-2012, 10:22 AM
  3. Make Table Warning Message
    By cassidym in forum Queries
    Replies: 1
    Last Post: 03-16-2011, 10:12 AM
  4. Warning Message for Missed Date
    By maintt in forum Access
    Replies: 2
    Last Post: 07-23-2010, 09:05 AM
  5. Access warning message
    By John Southern in forum Access
    Replies: 2
    Last Post: 05-28-2010, 06:01 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