UtterAccess Discussion Forums
  UtterAccess Home  | Forums Index  | Search  | Links DB  | FAQs   
Microsoft® Access help forums plus Excel, Word, Outlook®, Visual Basic®, SQL Server®, Office online and... many more!

Access UtterAccess!
New? Welcome!
Join UA here!

Members Login


Password


Remember me!


Search The Database

More Links

  UtterAccess Links
  Link to UtterAccess
  Call UtterAccess Home
  Add UA to Favorites

Quick Jump



UA Recommended

Access Team Blog

UA Recommended

UA's own ScottGem
      and datAdrenaline!

Servers tuned by
Peak Services
Close button X

  Close button X  Version: 2003 (11.0)

Posted on 12/10/04 05:06 PM
Posted by JAVIRAFY - Utter Access Addict
Posts: 158 -

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
How can I disable the minimize, maximize and close button of Access application?

  Re: Close button X  Version: 2003 (11.0) [Re: JAVIRAFY]

Posted on 12/10/04 05:12 PM
Posted by donpayseur - Utter Access Veteran
Posts: 235 - Loc: Charlotte, NC

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
Go to the Properties of the form and simply choose what features you would like the form to have. i.e.
min,max buttons, close etc.

  Re: Close button X  Version: 2003 (11.0) [Re: JAVIRAFY]

Posted on 12/10/04 05:13 PM
Posted by asmall - Utter Access Addict
Posts: 61 -

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
Open your form in design view, then set the "Min Max Buttons" to NONE and then set the "Close Button" to NO.

Alton

  Re: Close button X  Version: 2003 (11.0) [Re: JAVIRAFY]

Posted on 12/10/04 05:16 PM
Posted by JAVIRAFY - Utter Access Addict
Posts: 158 -

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
I meant the Access program min, max and close buttons, not my form


  Re: Close button X  Version: 2003 (11.0) [Re: JAVIRAFY]

Posted on 12/10/04 05:59 PM
Posted by JAVIRAFY - Utter Access Addict
Posts: 158 -

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
Can anyone help?

  Re: Close button X  Version: 2003 (11.0) [Re: JAVIRAFY]

Posted on 12/10/04 06:46 PM
Posted by Jack Cowley - UA Editor + Utterly Certified
Posts: 34836 - Loc: The San Francisco Bay Area

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
The attached demo will not affect the minimize and restore buttons but will keep the X button from closing Access. Open the demo (Access2000) and after the splash screen try to click the Access X button. Click on the Enable X button on the form and then the X button will work...

hth,
Jack

Re: Close button X  Version: 2003 (11.0) [Re: JAVIRAFY]

Posted on 12/10/04 06:48 PM
Posted by R. Hicks - UA Forum Administrator
Posts: 35398 - Loc: Birmingham, Alabama USA

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
Place the following code in a new module:
Code:
Private Declare Function apiEnableMenuItem Lib "user32" Alias _

"EnableMenuItem" (ByVal hMenu As Long, ByVal wIDEnableMenuItem As Long, _
ByVal wEnable As Long) As Long

Private Declare Function apiGetSystemMenu Lib "user32" Alias _
"GetSystemMenu" (ByVal hwnd As Long, ByVal Flag As Long) As Long

Function EnableDisableCloseButton(bEnable As Boolean, _
Optional ByVal lhWndTarget As Long = 0) As Long
Dim lhWndMenu As Long
Dim lReturnVal As Long
Dim lAction As Long

Const MF_BYCOMMAND = &H0&
Const MF_DISABLED = &H2&
Const MF_ENABLED = &H0&
Const MF_GRAYED = &H1&
Const SC_CLOSE = &HF060&

lhWndMenu = apiGetSystemMenu(IIf(lhWndTarget = 0, Application.hWndAccessApp, lhWndTarget), False)

If lhWndMenu <> 0 Then
If bEnable Then
lAction = MF_BYCOMMAND Or MF_ENABLED
Else
lAction = MF_BYCOMMAND Or MF_DISABLED Or MF_GRAYED
End If
lReturnVal = apiEnableMenuItem(lhWndMenu, SC_CLOSE, lAction)
End If

EnableDisableCloseButton = lReturnVal

ErrorHandling_Err:
If Err Then
MsgBox Err.Number & ":" & Err.Description
End If

End Function


Now ... in the first form of your application that opens .. place the following in the "On Load" event of the form:
Code:
Private Sub Form_Load()

EnableDisableCloseButton False
End Sub


The above code will disable the Close Button in Access.

Now add the following code to your Exit or Close button in your application:
Code:
Private Sub cmdExit_Click()

EnableDisableCloseButton True
DoCmd.Quit
End Sub


RDH

--------------------
Ricky Hicks
Microsoft MVP
Birmingham, Alabama USA

  Re: Close button X  Version: 2003 (11.0) [Re: Jack Cowley]

Posted on 12/11/04 09:33 AM
Posted by donpayseur - Utter Access Veteran
Posts: 235 - Loc: Charlotte, NC

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
Wow, good stuff Jack, you are awesome!

  Re: Close button X  Version: 2003 (11.0) [Re: donpayseur]

Posted on 12/11/04 12:13 PM
Posted by Jack Cowley - UA Editor + Utterly Certified
Posts: 34836 - Loc: The San Francisco Bay Area

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
The thanks go to Richard Rensel for creating the demo and posting it here at Utter Access.... Continued success with your project...

Jack


Page Jump
Pages: 1

Navigate
Post List
Previous thread Previous
Next thread Next

Thread Options & Info
• Threaded
• Print Thread

• 1281 Thread views

Page Jump
Pages: 1