No close (x) buttom for the access

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Filips Benoit

    No close (x) buttom for the access

    Hi,

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

    Filip


  • MacDermott

    #2
    Re: No close (x) buttom for the access

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

    HTH
    - Turtle

    "Filips Benoit" <benoit.filips@ pandora.be> wrote in message
    news:r4LTb.141$ tH5.112751@phob os.telenet-ops.be...[color=blue]
    > Hi,
    >
    > Is it possible to remove the access-application close-button (X)
    >
    > Filip
    >
    >[/color]


    Comment

    • Angel Mazo

      #3
      Re: No close (x) buttom for the access

      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 GetMenuItemCoun t 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(A pplication.hWnd AccessApp, 0)
      nCount = GetMenuItemCoun t(hMenu)

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

      'Make sure the screen updates
      'our change
      DrawMenuBar Application.hWn dAccessApp

      End Function

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

      Regards.

      Angel.

      "MacDermott " <macdermott@nos pam.com> wrote in message news:<i9LTb.736 2$jH6.2688@news read1.news.atl. earthlink.net>. ..[color=blue]
      > Not per se, but there are ways of preventing its use.
      > See www.mvps.org/access/forms
      >
      > HTH
      > - Turtle
      >
      > "Filips Benoit" <benoit.filips@ pandora.be> wrote in message
      > news:r4LTb.141$ tH5.112751@phob os.telenet-ops.be...[color=green]
      > > Hi,
      > >
      > > Is it possible to remove the access-application close-button (X)
      > >
      > > Filip
      > >
      > >[/color][/color]

      Comment

      Working...