Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Close button when viewing a report in print preview 2

Status
Not open for further replies.

bhoran

MIS
Nov 10, 2003
272
0
0
US
I am building a database that allows entry to tables. I am building the entire database using forms for navigation and choosing popup & Modal options to make it more secure and to reduce navigation problems for 1st time users.

However I cannot disable the windows close button when a report is viewed in print preview if the user hits that close they are left with a blank screen in the database. (I have created a new menu to handle closing the report and opening the relevant form if this std windows button can be disabled.)

Does anyone know how to disable this button or to reprogram the button to perform an open form command?

Cheers
 
Thanks Danvlas maybe I wasn't lear. I want to disable the std windows enabled close windows button (i.e. normal minimise, maximise and close buttons that exist on all windows appliations) so they can't exit any other way than via my custom menu.

cheers
 
To disallow exiting the application, use the Unload event of a form that is open all the time (possibly the main switchboard). Set the Cancel argument to True if a flag is not set by the Exit button on that form.

Option Compare Database
Option Explicit
Dim blnFlag As Boolean

Private Sub Form_Unload()
If Not blnFlag Then
Msgbox "Hey, why don't you use the Exit button???"
Cancel = True
End If
End Sub

In the Exit command button Click event:

blnFlag = True

There is a thread on tek-Tips on how to disable the Close Application button, but I can't find it now.

HTH


[pipe]
Daniel Vlas
Systems Consultant

 
I had a similar problem some time back and the only way I solved it was to open a small pop-up form with the report, and place it right on top of the close button. I then had a button on the popup which let me control the action to take.
 
Thanks danvlas but I am only trying to disable the close button for the report not for the application.

I could run the reports with a pop-up to allow the exit. Good idea thanks Digsy.

Cheers
 
Well... Access XP has the possibility to disable the Close button for the report. Previous versions don't have it...

The popup form solves partially the problem...if user drags it to another position, the close button becomes available.

That doesn't mean I have a better solution...



[pipe]
Daniel Vlas
Systems Consultant

 
Yes, I thought in Access 2000 if you went to print preview from a form that had no exit button (as defined in properties) the print preview also had no exit button but I have not worked on this stuff for 8 months or so, perhaps there is an option I have missed or perhaps I remember incorrectly.

Thanks for your help.

Cheers
 
I will go with the option to open the relevant form on the on close event. Thanks for all your help.

Cheers
 
Daniel:

Your first post above is painfully simple, yet ended my hair-pulling. Thanks.

Jay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top