By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,137 Members | 1,961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,137 IT Pros & Developers. It's quick & easy.

No close (x) buttom for the access

P: n/a
Hi,

Is it possible to remove the access-application close-button (X)

Filip
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Not per se, but there are ways of preventing its use.
See www.mvps.org/access/forms

HTH
- Turtle

"Filips Benoit" <be***********@pandora.be> wrote in message
news:r4******************@phobos.telenet-ops.be...
Hi,

Is it possible to remove the access-application close-button (X)

Filip

Nov 12 '05 #2

P: n/a
Yes, I found time ago (I can not remember where) this VBA code that
makes Access "X" disabled; it works perfectly in Access 97 I did not
try on newer versions:

Put this on a module and call bas106_DisableX (this name is mine, you
can change if you want)

Please, pay attention to word wrapping:

***** Code start **************
Public Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As
Long, ByVal bRevert As Long) As Long
Public Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long,
ByVal nPosition As Long, ByVal wFlags As Long) As Long
Public Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As
Long) As Long
Public Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long)
As Long

Public Const MF_BYPOSITION = &H400&
Public Const MF_REMOVE = &H1000&

Public Function bas106_DisableX()

Dim hMenu As Long
Dim nCount As Long

hMenu = GetSystemMenu(Application.hWndAccessApp, 0)
nCount = GetMenuItemCount(hMenu)

'Get rid of the Close menu and its separator
Call RemoveMenu(hMenu, nCount - 1, MF_REMOVE Or MF_BYPOSITION)
Call RemoveMenu(hMenu, nCount - 2, MF_REMOVE Or MF_BYPOSITION)

'Make sure the screen updates
'our change
DrawMenuBar Application.hWndAccessApp

End Function

***** Code end ******************

Regards.

Angel.

"MacDermott" <ma********@nospam.com> wrote in message news:<i9*****************@newsread1.news.atl.earth link.net>...
Not per se, but there are ways of preventing its use.
See www.mvps.org/access/forms

HTH
- Turtle

"Filips Benoit" <be***********@pandora.be> wrote in message
news:r4******************@phobos.telenet-ops.be...
Hi,

Is it possible to remove the access-application close-button (X)

Filip

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.