Results 1 to 3 of 3
  1. #1
    Alexandru Human is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    1

    Exclamation Prompt Pop Up Alert Message on clicking Form Button

    Hi guys!



    I am new to this wonderful DB program - MS Access 2013.
    A week ago I decided to create a Data Base for my company. So I decided to study Access using the Internet.
    Having learned some things about it, so I could create tables and forms, I learned to add various buttons in Forms.

    However, I do not want my employees to click those buttons unintentionally, especially when it come to the Delete Record button.
    This is why I would like my Delete Record Button to prompt a Pop Up Message saying: "Are you sure you want to delete the record?"

    I will be extremely thankful if you guys could teach me how to do it.

    Peace in our time!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Here's my template code for a yes/no message box:

    Code:
    Dim msg As String, button As Variant, title As String, response As Variant
    
    msg = "Vehicle is Shopped - Do you want to dispatch anyway?"
    button = vbYesNo + vbDefaultButton2
    title = "Vehicle Shopped!"
    
    
    response = MsgBox(msg, button, title)
    If response = vbYes Then
      'what to do if yes
    Else
      'what to do if not
    End If
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    There may be other things you'd want to consider, such as restricting the ability to delete records to groups or employee levels (perhaps by way of disabling buttons). Also maybe ensuring your db is backed up nightly on the network in case you need to fall back. I say this because in my experience, people just don't seem to pay attention to these prompts. Perhaps it's because they're rushed, or inundated with program prompts from other applications, or maybe it's just the crowd I used to work with. They'd constantly amaze me when having issues and I had to ask why the heck I bother putting those in if they're not going to read them. So just saying, it's not foolproof, and if it's very important, you more robust deletion prevention. Maybe tracking who deletes or edits important records too.

    If the idea of a message box still appeals to you, maybe check out the message box function in the object browser or help files so you can learn more about the button types and warning levels. I usually don't use the Else flow for a two possibility situation since if it is not the first, it is automatically the only other option. It's just a matter of style, and for me, writing less code when I can. Nothing wrong with having it either.

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

Similar Threads

  1. Replies: 2
    Last Post: 09-15-2015, 03:08 AM
  2. Replies: 10
    Last Post: 07-17-2014, 09:39 PM
  3. Replies: 3
    Last Post: 10-30-2013, 05:59 AM
  4. Replies: 9
    Last Post: 09-26-2012, 12:20 PM
  5. Alert Message Code Problem
    By 10 Gauge in forum Forms
    Replies: 1
    Last Post: 03-15-2011, 12:17 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