How to hide the 'X' in right corner

Russi

On the property sheet for the form try the following.

Popup = Yes
Modal = Yes
Border Style = Sizable
Control Box = No
Min Max Buttons = No
Close Button = No

Then it should work....i think!

The Problem may be exagerated by maximizing the form when it is opened or loaded but with those settings in place even with maximizing it should get rid of toolbars and menu bars and the close button.;)

HTH
John
 
Woodi the problem is he doesn't want pop ups...thats why it is essential he create his own menu bar and hide access's.
Jon
 
Oh dear I missed that:o

That might be interesting, Creating toolbar is no problem, coding out the close button might be interesting, but can you code out the close button for the application, and prevent someone doing Alt+F4 as well? I'd like to see that done. If the reason for doing it is to run some code you could put the code in the "on close" event of the form. That would catch it every time.

Or is there some other ulterior motive
 
Yes,

The code I provided again does just that gets rid of every 'x' in the application whether they are forms or the actual app. Yes you can stop someone from pressing alt F4 as well be checking keys that were pressed and handling from there.

Jon
 
On the form property key down events:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 115 And Shift = 4 Then
MsgBox "ALT-F4 is disabeled. To exit the application click the Close button.", vbInformation, "Alt-F4 Keystroke"
KeyCode = 0
End If

End Sub

ANd use the prior code I posted to get rid of the 'x'
Jon
 
That looks pretty nifty, disables the close on the app but not the form which I think is what russi is after, I'll just try the Alt+F4 bit, nice little trick
 
Russi's question has been answered.
Again you can modify the forms with the Control box property and that is why I said it's essential that he create his own menu bar otherwise the menu bar is displayed in the start options by default.
Jon
 
Why not just use a hidden form with a CanClose boolean?
Takes just a couple of lines of code, not reams of it
:rolleyes:
 
First, a BIG THANK YOU TO ALL. I am unable to enter my office until Monday, but I will check the code Jon sent me.

JON -- 1st, sorry about not giving you a head's up on hidden items. -- My problem was that I would do the control box 'no' etc. but it truly did not work. I put it for instance on my enterFamilyInfi, enter Family Info, Clinet Basic Info and family Info screens, and all still showed the X and it worked as always. -- Jon, was this because it involves sub-forms? (Users enter client name/idnumber in one, and then a form of Clinet Basic Info shows with the appropriate subform of Family Info.) Same problem with Work History related forms.
Tomorrow I will try your code and suggestions.

Rich, what is that boolena loop code you referred to?

Thanks, one and all.

Russ
 
Dim CanClose As Integer
Private Sub Form_Unload(Cancel As Integer)

If Not CanClose Then
Cancel = True
Forms!MyForm.Visible = True

just put some message on the form and handle the db closure from there
 
Hello all,

I'm in a similar position as Russi in that I'm trying to get rid of the Close X box on the menu bar when I maximise all my front end forms.

I've been reading this thread and followed mission2java_78's advice :

"create your own Custom bar which is very simple to do. View->toolbars->customize ... and make sure you do not allow for the X. Give it a name and in the tools->startup options there is a menu bar option make sure you unselect "Default" and enter your own menu bar. You could always hide yours as well so that there is no menu bar. "

Unfortunately I'm very new to Access and ran into a few probs - How do you deselect the close box on a menu bar as it always seems to appear automatically on the dominant bar? Failing that, how do you hide the menu bar?
:confused:
Yours in hope,
Scott
 
Make sure you click tools->customize
click new
give it a name
highlight this new custom bar
goto properties
make sure you the type is "toolbar"
make sure all the check boxes are checked off
goto tools->startup and change the setting of the default menu bar from access's to yours.
Jon
 
Thanks!

Jon,
Thanks for the info - success. I had to make the bar type a 'menu' rather than 'toolbar' but once that was done I could turn them both off. Great, now I can go on holiday without sweating that somebody will get past the front end.
Thanks again,
Scott
:)
 
How exactly do you turn "off" both menu bars?? Once the toolbars are turned off is there a way to turn them back on??
 
Menu bar and close box removal

Laurat,
I'm using Access 97 and I initially found I could not get rid of the default 'menu bar'. But then I followed the instructions and made my own toolbar. I set it's properties to 'menu bar' and ticklisted it on. I left the application and then came back into Access. I found that the default menu bar could now be unticked as well as my own custom one. - success - more by accident than design but I wasn't complaining.

Getting it back - I have my own form as a switchboard and I right click to see the design view. This brings up the form editing toolbar automatically. You can right click on this to get into selecting your menu bar from a drop down list or in customisation.
Scott
 
Hi Scott,

Your solution works and is fine BUT do you really want to be able to allow for right clicking and going to design view? A user can mess up your forms like this. I have a better solution if you are interested.
Jon
 
Hi Jon,

I'm open to any suggestion. (Access related that is!) I did come up with a solution to folk getting into design view but it is a little clunky.

I've set up the group permissions so that they do not have access to design view on any form. The permissions also stop them from messing up the tables etc if they do get to look at them. But one table, operator passwords, they could 'read' and see everybodies code. This is why I had to strip out the menu bar and it's close box.

If there is a more elegant solution I'm all ears.
Thanks,
Scott
 
Ack you used Access security I don't use Access security so my solution probably isnt the best solution in your case. But generally I hide the shortcut menu on ALL forms so there is no right clicking and design view. I then have a button which allows / bypasses for some properties that are very important such as the db window/ shift key/ etc.

Jon
 
Eureka!

1st, i never realized how long/viewed this post would have become. AND I want to thank all for their ideas.

But, given that I use Access 97, maximized windows, forms with subforms, etc., I still ran into weird issues trying to do this.

A DIFFERENT & GREAT SOLUTION that I would like to share. I came across it elsewhere. It works like a dream!
It allows the 'X' to show, BUT if the user clicks on either the form's 'X' or the Access 'X', it won't work. Only thing that works is any command button designed for that behavior.

Supposedly it comes from a book called: Access Developer's Handbook, Volume 1.

Here it is. Put this in a module.

Option Compare Database
Option Explicit

Public AllowClose As Boolean

Private Sub Form_Load()
AllowClose = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
Cancel = Not AllowClose
End Sub
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click

AllowClose = True
DoCmd.Close

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click

End Sub

THEN, in each form's LOAD property, put:
AllowClose = False

THEN, in each form's UNLOAD property, put:
Cancel = Not AllowClose

FINALLY, in each 'exit' command button's CLICK property, put:
AllowClose = True


AGAIN, THANKS TO ALL OF YOU, HERE!

Russ
 

Users who are viewing this thread

Back
Top Bottom