Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    close forms (2k or 97 )

    how i can prevent the user to close the report from (x) in yhe corner of the report .
    ashrafk

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: close forms (2k or 97 )

    Create a public variable called boolFormCloseable
    In the open event of the form set it to false
    In the unload event put

    If boolFormCloseable = false then
    DoCmd.CancelEvent
    End if

    In the code for the close method you want used put

    boolFormCloseable = true

    before the code to close the form.
    David Grugeon
    Brisbane Australia

  3. #3
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: close forms (2k or 97 )

    Thank u very much it work well . but i can not do it with a report . i donot know why ?
    ashrafk

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: close forms (2k or 97 )

    Sorry, I had not read your post carefully enough. A report does not have an unload event and therefore closing cannot be cancelled.

    If you could let us know why you want to prevent the form being closed by the x (close box) we could possibly suggest another way of dealing with the problem.
    David Grugeon
    Brisbane Australia

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: close forms (2k or 97 )

    Why would you want to prevent users from closing a report? Reports are generally displayed in preview mode so someone can see what it will look like. All the user can do is print it or close/cancel it. Are you trying to force them to print it or what?
    Charlotte

  6. #6
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: close forms (2k or 97 )

    Thank u all ,
    you r right i have a user when he try to close the report from (x) he put the mouse at (x) of Access so it colsed the application all although i do a toolbar with the report . so i try to prevent him from close it from (x).
    thanks u again

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: close forms (2k or 97 )

    OK. Now I understand what we are trying to achieve. The way I deal with this is usually to open a form at startup which has the stuff I described above to prevent it closing or to bring up a message box "Did you really want to exit the application?". Until the Yes of the messagebox is clicked the application cannot be closed (other than through task manager or pulling out the plug!)
    David Grugeon
    Brisbane Australia

Posting Permissions

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