Close a form without saving changes to the form's design/properties?

  • Thread starter Thread starter Vincent Verheul
  • Start date Start date
V

Vincent Verheul

Hello,

I work a lot with filters in my Access application. With VBA I apply filters
to forms and subforms. I think this is the major reason that my FrontEnd
bloats all the time. That's why I thought of a way to prevent Access to save
changes to the Forms.

I want to allow the user to use the normal control box to close a form
(adhere to Windows Standards). That's why I'm looking at the From_Close or
Form_Unload events to do some coding there.

A quick try-ouy as shown below doesn't work: error 2501 'The close action
was canceled'.

Private Sub Form_Unload(Cancel As Integer)
Static Recursive As Boolean

If Not Recursive Then
Recursive = True
Cancel = True
DoCmd.Close acForm, Me.Name, acSaveNo
End If

End Sub

Any ideas, comments?

TIA
 
If your front end is bloating, and you're in any version above Access 97,
set your options to CompactOnClose, and you're done.
My guess is that the extra space in your database is allocated when you
create/apply the f ilter, not when you save...

HTH
- Turtle
 
Thanks!

I'll now look into a way to set this option through VBA, since the users
will probably not have this setting switched on...

Vincent
 
Some option settings are unique to the database; some affect all Access
applications on that PC.
The Compact on Close option is unique to the database, so if you give your
users a copy with it set, that option will be in force on their machines for
that database as well.

HTH
- Turtle
 
Back
Top