Results 1 to 12 of 12
  1. #1
    Join Date
    Apr 2006
    Posts
    157

    Question Unanswered: Disable Msaccess Close Button

    hello,


    I just wanted to ask if there is any way that I can disable the msaccess
    close button so that the user has no other option of closing the database other that its custom close button?



    thanks again
    syntaxerror

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Yup. I declare a global boolean variable and set it to true when the "close" button is pressed. Then in the form's unload event I do something like this:

    Code:
    Private Sub Form_Unload(Cancel As Integer)
    If c <> True Then
        Cancel = True
    End If
    End Sub
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    In the Form properties, set close Button to False
    Start your form, the close button will be now disabled ..

  4. #4
    Join Date
    Apr 2006
    Posts
    157
    thanks,


    but not quite though, I am actually referring to the msaccess program itself and its close button.

    I'm not even sure if this is possible

    ty again,

    syntaxerror

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Did you try what I posted?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    It is possible - but it requires a class and some groovy API programming. I'll dig up my link....
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    More options than you could shake a HWnd at:

    http://home.bendbroadband.com/conrad...osebutton.html
    Testimonial:
    pootle flump
    ur codings are working excelent.

  8. #8
    Join Date
    Apr 2006
    Posts
    157

    magnifico

    hey the microsoft link works well!

    thanks,

    haven't tried tech on the net yet.

    i've been sweating out several hours through the net... each time coming up with squat

    thanks very much guys,

    syntaxerror

  9. #9
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    The microsoft one is overkill.

    Like I said in my first post:

    Code:
    Dim c As Boolean
    
    Private Sub btnClose_Click()
    c = True
    DoCmd.Quit
    End Sub
    
    
    Private Sub Form_Unload(Cancel As Integer)
    If c <> True Then
        Cancel = True
    End If
    End Sub
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  10. #10
    Join Date
    Apr 2006
    Posts
    157
    yup got that,

    but i have a confirmatory msgbox on my exit access so I no longer use the unload event or should I?



    anyway, the tech on the net code results to... no discernible effect



    this particular command makes me curious though

    Application.CommandBars("File").Controls("Exit").E nabled = blnExitState

    does it even see msaccess?:

    then again it may not be necessary to turn off the exit command in the file menu.


    thanks and thanks again

    syntaxerror

  11. #11
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Ah - I see where Teddy was going now.

    blnExitState is a boolean variable. Just change it to False to see the effect.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  12. #12
    Join Date
    Apr 2006
    Posts
    157
    finally,

    just used the tech on the net application... command, worked fine. I actually used it in the load event.

    everything polished, but how does enabling the command in the unload event differ from using it in an exit button's on-click event?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •