Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 02-29-2008, 08:21 AM   #1
Bobby1st
Registered User
 
Join Date: Jan 2007
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Bobby1st is on a distinguished road
Smile How to gray out the "X" main close appl icon

This is a continuation of my thread posted 2/21/08, solved by Rolaaus. Reference: Log In and Log Out Information Save.

The Log Out is now working, saving the posted date-time information only when the exit button on the main menu is selected.

On the main menu form properties, the Close Button is set to No and force the use of the Exit button on the form. I did not utilized the On-Close properties or the visible = False, because it might create more problem for me to when open/closing lots of forms and reports.

The issue and how best fix it.:
When another open_form is called, there's no "X" icon to use as exit, however, when open_report is called there are two "X" icons, one for the report and the other the application exit, when use, it by-pass my script to log the Date-Time value. How and where will I be able to gray out the application "X" button?

Thanks

Bobby1st is offline   Reply With Quote
Old 02-29-2008, 10:21 AM   #2
RuralGuy
AWF VIP
 
RuralGuy's Avatar
 
Join Date: Jul 2005
Location: @ 8300' in the Colorado Rockies
Posts: 13,820
Thanks: 7
Thanked 311 Times in 301 Posts
RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice
Does this thread help at all?
__________________
(RG for short) aka Allan Bunch Previous MS Access MVP acXP, ac07, ac10, ac13 - WinXP Pro, Win7 Pro, Win10 Pro
Please post back to this Forum so all may benefit.
Teaching is not filling a bucket but lighting a fire.
RuralGuy is offline   Reply With Quote
Old 02-29-2008, 10:22 AM   #3
RuralGuy
AWF VIP
 
RuralGuy's Avatar
 
Join Date: Jul 2005
Location: @ 8300' in the Colorado Rockies
Posts: 13,820
Thanks: 7
Thanked 311 Times in 301 Posts
RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice
How about http://www.mvps.org/access/api/api0022.htm?

__________________
(RG for short) aka Allan Bunch Previous MS Access MVP acXP, ac07, ac10, ac13 - WinXP Pro, Win7 Pro, Win10 Pro
Please post back to this Forum so all may benefit.
Teaching is not filling a bucket but lighting a fire.
RuralGuy is offline   Reply With Quote
Old 02-29-2008, 10:33 AM   #4
KeithG
AWF VIP
 
KeithG's Avatar
 
Join Date: Mar 2006
Location: Illinois
Posts: 2,592
Thanks: 0
Thanked 4 Times in 4 Posts
KeithG will become famous soon enough KeithG will become famous soon enough
Paste the below code into a new module

Code:
Public Declare Function GetSystemMenu Lib "user32" _
                                      (ByVal Hwnd As Long, ByVal bRevert As Long) As Long
Public Declare Function DeleteMenu Lib "user32" _
                                   (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Declare Function DrawMenuBar Lib "user32" (ByVal Hwnd As Long) As Long



Public Sub DisableX(Handle As Long)
    Hwnd = Handle
    Dim hMenu As Long
    hMenu = GetSystemMenu(Hwnd, 0&)
    If hMenu Then
        DeleteMenu hMenu, SC_CLOSE, MF_BYCOMMAND  'Disable the Close button
        DrawMenuBar (Hwnd) 'Repaint the MenuBar
    End If
End Sub

Then call the sub from the above code to disable the X button. Like below

Code:
Call DisableX(Application.hWndAccessApp)
__________________
If my post has helped you solve your problems please add to my reputation. Click the scale in the top right side of this post.
KeithG is offline   Reply With Quote
Old 03-05-2008, 10:41 AM   #5
Bobby1st
Registered User
 
Join Date: Jan 2007
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Bobby1st is on a distinguished road
KeithG,
I tried diff. ways but I am getting variables not defined. it can't recognized the Hwnd; hmenu; SC_Close. I tried declaring a Dim, didn't work. I copied it exactly as posted.


RuralGuy, since the issue is the same maybe I my missing the user32? I don't know that.

Thank you.

Bobby1st is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Close button reappearing even though close button property is set to "No" watrout Forms 3 03-23-2009 01:01 PM
Close button "X" Johny Forms 3 10-07-2004 03:09 AM
hide the close "X" and "max." of Acces bassy Modules & VBA 11 05-02-2003 09:32 AM
Stopping Access Main Window Close W/o Disabling Close Button robert brinkman Reports 1 04-17-2003 01:15 PM
Close Access97 Open Sessions and Then Close Database- new twist llyal Modules & VBA 2 04-11-2000 04:07 AM




All times are GMT -8. The time now is 05:16 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World