Wrox Programmer Forums
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 9th, 2004, 06:23 PM
Friend of Wrox
Join Date: Sep 2003
Posts: 451
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Ben Horne
Default Disable Close Button

Hi all,

I have this little piece of VBA code inside my Music Inventory 2001 app that I've applied to almost all of my reports.

Private Sub Report_NoData(Cancel As Integer)
'If there are no duplicate records pertaining to an artist, display a message

    Dim strMsg As String, strTitle As String
    Dim intStyle As Integer

    intStyle = vbOKOnly
    strTitle = "Music Inventory 2001"

    MsgBox strMsg, intStyle, strTitle
    Cancel = True
End Sub

My question is this, Is there any way to disable the close button(it's got an x on it) in the upper right-hand corner of all messages that pop-up?

Ben Horne
Madison Area Technical College student


Go there. I have a lot of awesome photos that I rendered myself

"There are two kinds of people in the world: Those who claim to be Flash junkies and those who actually are Flash junkies"
Ben Horne
I don\'t want to sound like I haven\'t made any mistakes. I\'m confident I have.

Most likely using FireFox and concocting my next Macromedia Flash project
Snibworks Forums Moderator

Welcome to the New Age
Old April 12th, 2004, 03:29 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts

Given that your code doesn't do anything based on the response of the MsgBox (and since there is only one possible option anyway), why do you need to get rid of it?

Regardless, what you might want to do is create your own MsgBox form, with the PopUp and Modal properties set to true, the BorderStyle set to dialog, and all the buttons (Min/Max, Close) and the Shortcut Menu properties set to False.


I am a loud man with a very large hat. This means I am in charge

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modal dialog - Disable Close button itHighway Classic ASP Basics 1 July 31st, 2005 06:36 PM
Modal dialog - Disable Close button itHighway Javascript How-To 1 July 31st, 2005 01:58 AM
Disable "close window option" szms VB.NET 2002/2003 Basics 0 April 7th, 2005 11:46 AM
disable close button in mdi form nkramanmca VB How-To 4 January 6th, 2005 12:31 AM
how to disable a close button on VB form chanti VB How-To 2 September 30th, 2004 06:21 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.