Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
MsgBox No Default Button
Scott Axton 
        
5 years ago
OK guys - I hate to admit it but I'm stumped.

In creating a Y/N/Cancel prompt -  I know how to adjust which button is the default button. That works great for me every time.

What I can't figure out is how to make NONE of the buttons defaulted.  I want to force the user to click the button. Not just press enter to 'click' the button.

Any ideas?


Richard Rost  @Reply  
          
5 years ago
That's a good one, Scott. You're not crazy. I don't think it can be done. I ran into this a couple of years ago. What I did was make the Yes/No/Cancel button, default it to CANCEL, and if the user selects cancel, tell them they need to manually click YES or NO. Here's what I did:

    Dim L As Long
    L = vbCancel
    While L = vbCancel
        L = MsgBox("Are you sure?", vbYesNoCancel + vbDefaultButton3)
        If L = vbCancel Then MsgBox "You must select YES or NO"
    Wend
    MsgBox IIf(L = vbYes, "YES", "NO") & " clicked"


Excellent question. I might make this into a TechHelp video. :)
Richard Rost  @Reply  
          
5 years ago
Or, of course, you could make your own popup MsgBox form that has its own rules, kinda like I did in Developer 11.
Adam Schwanz  @Reply  
           
5 years ago
Yea I just spent 30 minutes googling for stuff and none of it works, the only working solution was "build your own"
Scott Axton OP  @Reply  
        
5 years ago
Thanks Richard.  I was beginning to doubt myself.  Thinking that the simple little task was eating at my brain!
LOL.
Richard Rost  @Reply  
          
5 years ago
Don't feel bad. I remember spending a good half hour Googling this too a few years ago. You'd think they would add a vbDefaultButtonNone option, but alas. I'll add this to my list of Microsoft Feedback.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

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 7:18:16 PM. PLT: 1s