Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > MsgBox Options 2 < MsgBox Options | Named Arguments >
MsgBox Options 2
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   3 years ago

Access MsgBox Options. Set No as Default, Part 2


 S  M  L  XL  FS  |  Slo  Reg  Fast  2x  |  Bookmark Join Now

This is Part 2 of 2. In this Microsoft Access tutorial, I'm going to teach you how to change the default button in a message box so it's not the first one. This way, you can have "No," "Cancel," or any other type of button as your default option. We'll also discuss other properties of a message box, such as the icon, sound, and all that good stuff.

Members

There is no extended cut, but here is the database download:

Silver Members and up get access to view Extended Cut videos, when available. Gold Members can download the files from class plus get access to the Code Vault. If you're not a member, Join Today!

Prerequisites

Recommended Courses

Learn More

FREE Access Beginner Level 1
FREE Access Quick Start in 30 Minutes
Access Level 2 for just $1

Free Templates

TechHelp Free Templates
Blank Template
Contact Management
Order Entry & Invoicing
More Access Templates

Resources

Diamond Sponsors - Information on our Sponsors
Mailing List - Get emails when new videos released
Consulting - Need help with your database
Tip Jar - Your tips are graciously accepted
Merch Store - Get your swag here!

Questions?

Please feel free to post your questions or comments below or post them in the Forums.

KeywordsMsgBox Options in Microsoft Access, Part 2

TechHelp Access

 

 

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to MsgBox Options 2
Get notifications when this page is updated
 
Intro In this video, we continue exploring message box options in Microsoft Access. I'll show you how to use the right-to-left reading option, customize the message box title, and work with return values. You'll see a practical example where we build a multi-step confirmation using message boxes and different button settings, including how to make the default button Cancel and display critical warnings. This is part 2.
Transcript Welcome to another TechHelp video brought to you by AccessLearningZone.com. I'm your instructor, Richard Rost.

This is part two of my message box options video. If you have not watched part one yet, go watch it. You will find a link down below. Go watch that first, then come on back.

Here we go. We are already in progress.

Message box right-to-left reading does make the text go right to left. It does not reverse the order of the characters, but it will put the question mark at the end for a question button, and it reverses the order of the buttons.

You still have to make sure that your language is right-to-left on your own, but you can set that option for the message box if you want to.

Title is the next option, the next parameter down here. Pretty straightforward. You put a title right there and it will not say Microsoft Access. So many people are worried about making their applications so it does not look like Microsoft Access.

They want to distribute something that does not look like Microsoft Access. I do not know why. I love Access. If one of the things you want to do is hide your application so it does not appear to be Access, or you want to just give more information about what is going on, put it in the title.

The message box return values again. We talked about this in the last message box video. Here are all the return values, and they correspond to the different buttons. Yes is a reply, ignores reply if you are using an Ignore button. Here are the values again. You do not need to use the actual values, you can if you want to, but you can just use VBOK, VBCancel, VBAbort, and so on. Take your response value, check to see what it is, and then respond accordingly.

So, knowing all this, let us run through an example database. We are going to build a computer self-destruct button, which you can use for something like running a delete query. I do not expect you to self-destruct your computer, but we will do two message boxes in line.

First, you want to activate the self-destruct button. We are going to make the default button Cancel, make it a question, and if they say Yes to this, then we will go "Are you sure?" with a critical "Seriously activate self-destruct." If they say Yes to that, then it will perform the action.

Ready? Here we go.

Here I am in my TechHelp free template. This is a free database you can download off my website if you want to, and down here, I have a Hello World button that right now just uses my status function to put the words "hello" in this text box.

Let us change this to a message box. I am going to right-click "Build Event." It is going to bring up my VBA editor over here, and just like I showed you in the other video, what are we going to do?

We are going to say:

If message box "Activate self-destruct?" (question mark), then comma. Here is where you put your buttons in, so I want VBYesNoCancel. I am going to go down arrow, tab, and then plus. Now I can pick my VBDefaultButton3, which is right there, and then tab, so you can click on it with the mouse or use the keyboard, whatever you want.

I also want to make it a question, so plus VBQuestion, tab, comma, my title, and then I put "Go Boom", and then close it up.

You can either take that and put it in a variable if you want to do more stuff with it, or I just put it right in the If statement myself, that is an option.

Now I can say, if that is anything other than (greater than, less than, two, is not equal to) if it is anything other than VBYes, then Exit Sub.

That is a pretty long line, so I am going to break it right here.

Now they can still get into trouble because they are going to blow the whole thing up. The whole ship is going to go boom. So we are going to ask them a second time. I am going to just copy this one. Copy. Control-C, Control-V. We will ask them again. "Seriously, activate self-destruct."

VBYesNoCancel, default button three. This time, we are going to go VBCritical though, so I am going to backspace over that, hit the plus again, and then come down to VBCritical. Over here you can put in the title, "Are you sure?"

Again, if they say Yes to that, it will continue, otherwise it will exit out of the subroutine. If they get this far, it is going to go boom. So we will just go Status "Boom".

Save it. Always helpful to throw in a Debug Compile. Come back over here. Let us close the main menu and reopen it.

I have code that moves my window. Do not worry about that. Slide it back up here.

Hello World. Activate self-destruct. Now notice default button three is active, so if I accidentally hit the space bar it goes away, which is desired. But if I come in here and say Yes, it is going to... oh, did you hear that? It gave you the little warning, right? "Seriously activate self-destruct." Cancel.

Let us do it again, say Yes both times. Yes. Yes. And it went boom.

That is that.

If you like learning this stuff, if you like learning with me, if you want to learn more VBA, check out my developer lessons on my website. I have lots of them and I cover lots of different ways to use message box. There is the link right there. I will put another link down below. Check it out and do not forget to check out my Access Developer Level 11 and 12 classes if you want to learn how to build that universal dialog box and a lot more cool stuff too.

That will do it. That is your TechHelp video for today. I hope you learned something. Live long and prosper, my friends. I will see you next time.
Quiz Q1. What effect does the right-to-left reading option in a message box have?
A. It changes the direction of text and also reverses the order of characters.
B. It makes the text display right to left and reverses the order of question marks and buttons, but not the characters.
C. It only translates the text into a different language.
D. It simply bolds the message box text for emphasis.

Q2. Why might someone want to change the title of a message box in an Access application?
A. To prevent the message box from appearing at all.
B. To replace the default Microsoft Access title and make the application look more customized.
C. To add buttons to the message box.
D. To change the color of the message box.

Q3. What are message box return values used for in VBA?
A. To display a message to the user.
B. To determine which button the user pressed and take appropriate action.
C. To assign color schemes to different buttons.
D. To create additional message boxes automatically.

Q4. Which of the following is a valid way to check the user's response in a message box?
A. Check if the response equals "Yes".
B. Check if the response is equal to VBYes.
C. Use messagebox.response = "No".
D. Create a new event handler for each possible response.

Q5. In the example described, why is the default button set to Cancel for the self-destruct confirmation message box?
A. To make it more likely that the user will proceed with the self-destruct.
B. Because Cancel is always required in all message boxes.
C. To reduce the chance of accidental confirmation by making Cancel the default choice.
D. It is the only button that can be used as a default.

Q6. What is the purpose of displaying a second confirmation message box before executing the "self-destruct" action?
A. To ensure the user is really sure by asking them twice before performing a critical action.
B. To slow down the process on older computers.
C. To demonstrate the use of VBCritical in code.
D. To avoid showing any return values.

Q7. What does the VBCritical parameter do in the message box?
A. It makes the message box unable to close.
B. It assigns a critical icon and sound to the message box.
C. It translates the message automatically.
D. It disables all buttons except Yes.

Q8. If the user does not select Yes in either confirmation message box, what does the code do?
A. It restarts the application.
B. It exits out of the subroutine without performing the action.
C. It closes Access entirely.
D. It locks the user out of the database.

Q9. Which of the following statements about using message box parameters and return values is TRUE?
A. You always have to use the numeric value of the return values.
B. The message box return value helps you decide how to proceed based on the user's choice.
C. Changing the title parameter removes all buttons.
D. You can only use one parameter at a time with a message box.

Q10. In the code example, what is printed to the status box if the user confirms "Yes" in both message boxes?
A. hello
B. Goodbye
C. Self-destruct activated
D. Boom

Answers: 1-B; 2-B; 3-B; 4-B; 5-C; 6-A; 7-B; 8-B; 9-B; 10-D

DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.
Summary Today's TechHelp tutorial from Access Learning Zone explores advanced options for using message boxes in Microsoft Access VBA. This is the second part of my message box options lesson, so if you have not watched the first part yet, I recommend checking that out before continuing.

Continuing from where we left off, I will clarify how the right-to-left reading option works in a message box. This feature changes the text alignment to read from right to left, which is helpful for languages that require this format. It does not reverse the actual characters, but it does move interface elements like the question mark and button order. You still need to write your message in the correct language, but this setting can be applied to make the dialog more accessible for right-to-left reading users.

Next, let us discuss how to set the title of your message box. By default, Access uses "Microsoft Access" as the title for message boxes. If you want your application to appear more customized and less like a generic Access database, you can specify your own title. This is a frequent concern for developers who want their applications to have a distinct look or give clearer instructions. Adding a specific title, such as information about the current task or alert, can make your interface feel much more professional.

Let us review message box return values. We talked about these in the previous lesson, but it is worth repeating. When a user clicks a button on the message box, Access returns a value corresponding to the user's choice. These include options like OK, Cancel, Abort, Retry, Ignore, Yes, and No. You can test for these replies directly with constants like VBYes or VBCancel, making your code easier to read and manage. There is no need to use the numeric values unless you prefer to do so.

To demonstrate how this all comes together, I will build a sample utility in our example database: a self-destruct button, which you could adapt for actions such as executing a delete query. Of course, I do not expect you to destroy your computer, but this example showcases how to layer multiple message boxes for extra confirmation before carrying out a critical operation.

Here is how the process works. First, the user clicks the self-destruct button. This triggers a message box with the default button set to Cancel, styled as a question. If the user selects Yes, a second message box appears, this time with a critical icon, and asks, "Seriously activate self-destruct?" Only if the user clicks Yes again does the action proceed. This kind of double confirmation is good practice for destructive operations.

Let me walk you through setting this up. I am working in my free TechHelp template database, which you can download from my website. Previously, the button displayed "Hello World" in a text box. Now, I will update the event procedure behind the button to use a message box instead.

I open the VBA editor and write an If statement that prompts the user with "Activate self-destruct?" along with VBYesNoCancel buttons. I set the default button to the third option (Cancel) and assign the question icon. For the title, I chose "Go Boom." This combination of button choices, icon, and title helps make the message box clear for the user.

If the response is not Yes, the subroutine exits. If the user does click Yes, a second message box appears, prompting, "Seriously, activate self-destruct" with the critical icon and a new title, "Are you sure?" Again, if the answer is not Yes, the process stops. If Yes is selected, then the action runs – in this case, simply updating the status to display "Boom."

After updating the code, it is a good practice to compile it to catch any errors. Back in the form, opening the menu and triggering the button will now bring up the self-destruct confirmation dialogs as intended, with the Cancel button set as default to reduce the chance of accidental mistakes. If the user confirms both prompts, the final action executes.

Learning to use message boxes this way gives you more control over user interaction and helps prevent accidental data loss by building in layered confirmations.

If you enjoy learning about VBA and want to expand your skills, I have many detailed developer lessons available on my website. You will find courses covering additional ways to use message boxes and advanced techniques, including how to build a universal dialog box in Access Developer Level 11 and 12.

You can find a complete video tutorial with step-by-step instructions on everything discussed here on my website at the link below.

Live long and prosper, my friends.
Topic List Message box right-to-left reading option
Setting custom message box titles
Using message box return values
Checking message box responses in VBA
Creating a double-confirmation message box sequence
Setting the default button in a message box
Combining multiple message box options with plus sign
Using VBYesNoCancel button options
Applying VBQuestion icon to a message box
Applying VBCritical icon to a message box
Exiting a subroutine based on message box response
Displaying feedback with a status message after user selection
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/1/2026 8:22:57 PM. PLT: 1s
Keywords: TechHelp Access  PermaLink  MsgBox Options in Microsoft Access, Part 2