Solved

Close form without saving

Posted on 2004-04-07
25
283 Views
Last Modified: 2008-03-17
Hi,

How do I get a Close event never to prompt to save?

Basically, I have a procedure that modifies a form in design view before opening it.  When the user closes it (with X button or CTRL+F4), it always prompts to save changes.

I would make a Close button (docmd.Close (acSaveNo)), but the form is in Datasheet view.  Even if I had a button, the user could always use CTRL+F4, which I believe directly triggers the close event.

How can I get around this?

Basically, I just do not want a user to save these changes or even be bothered to do so!

Thank you.
0
Comment
Question by:Reaver2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
  • 2
  • +2
25 Comments
 
LVL 34

Expert Comment

by:flavo
ID: 10779753
Set the from properites to Allow edits to false?
0
 
LVL 34

Expert Comment

by:flavo
ID: 10779759
woops... sorry.. read your post wrong
0
 

Author Comment

by:Reaver2
ID: 10780002
Tis ok.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 34

Expert Comment

by:flavo
ID: 10780033
I dont think you can...

Why are you changing (and how) the form in design view with code?

What are you changing, you should be able to run some code on the Load event to do most things..
0
 

Author Comment

by:Reaver2
ID: 10780052
It's a form in datasheet view.

A command button in another form opens it in design view, changes some textboxes' ColumnHidden property to True, then opens the form in Datasheet view.

This way, not every field is being shown, but only what the users wants to see.  But unfortunately, this means design changes that may or may not be saved (as Access think I want!).
0
 
LVL 34

Expert Comment

by:flavo
ID: 10780140
Why not use a conintuous form in "normal view"... You can make it look like a datasheet, and not have the saving problem..
0
 
LVL 12

Expert Comment

by:nexusnation
ID: 10780235
0
 
LVL 34

Expert Comment

by:flavo
ID: 10780255
Tried that on the Close and it didnt seem to work...
0
 

Author Comment

by:Reaver2
ID: 10783186
I don't know if it is actually possible to modify an event like this.  There has to be an alternative.
0
 
LVL 34

Expert Comment

by:flavo
ID: 10783233
Just make a form (continous) to make it look like a datasheet.  can be done, wont look exactly the same, but very very close
0
 

Author Comment

by:Reaver2
ID: 10783547
I know one solution.  I'll set SetWarnings to False.  Only thing:  When do I set it?!!  (Save warning occurs BEFORE unload event!)

I do not want to set it on Open event, because anything could happen.  Can anyone think of any messages that you would WANT to see?  I have deletions disallowed, so not showing that warning is not an issue.  What else would be a warning?

I'll set SetWarnings (False) on Open and SetWarnings (True) on Close. . . If there is no risk of missing an important warning.
0
 

Author Comment

by:Reaver2
ID: 10783558
But flavo, if the user enters CTRL+F4, it still calls the Close event.
0
 
LVL 34

Expert Comment

by:flavo
ID: 10783614
>> if the user enters CTRL+F4, it still calls the Close event

But if its done as a continuos "normal" form looking like a datasheet, you wont have to go into the design mode to change everthing, it will be there.  It wont matter if they hit Ctrl+F4

Be carefull with SetWarnings, but at this stage i cant think of any thing that could happen, but ive never used datasheet view as i find it limited, as you have found out.
0
 
LVL 12

Expert Comment

by:nexusnation
ID: 10783769
Did you see my link, Reaver? Maybe I was rerading your question wrong...
0
 
LVL 34

Expert Comment

by:flavo
ID: 10783831
doesnt work, tested before
0
 

Author Comment

by:Reaver2
ID: 10785503
flavo,

I agree, but I just like using Datasheet view because I'm just learning about Access.  One problem in my situation in using a form in "Tabular" format is that I have several (11) checkboxes, and each checkbox has a label above it.  It is just a hassle to design it because the labels are all squished together.

The other thing is that if I just set the Visible property of those Textboxes to False, then there would be a bunch of 'HOLES' in my table (which would require adjusting in Design View).  In a Datasheet, hiding columns makes the other fields squish together (if you know what I mean).

How can I work around this?

m
0
 
LVL 11

Expert Comment

by:phileoca
ID: 10787301
what about using the system function:

DoCmd.SetWarnings False

no warnings, hakuna matata.

<>< KT
0
 
LVL 11

Expert Comment

by:phileoca
ID: 10787309
bah, missed that you had that reaver2

/ignore phileoca
0
 
LVL 34

Expert Comment

by:flavo
ID: 10788870
>> How can I work around this?

Dont add them in the first place.  You only need to add the thnigs you want.

It will take you id say about 30 mins at the most to do.

0
 

Author Comment

by:Reaver2
ID: 10808495
What do you mean flavo?  Don't add checkboxes?  My thing is that datasheet view makes it easier to hide fields.  In form view, if you hide a field, you have to manually MOVE all the other fields, which must be done in design view (or it will look ugly).

Any other ideas?
0
 
LVL 34

Expert Comment

by:flavo
ID: 10808560
ok..

Why exactly are you trying to hide columns in the first place??

Why cant you hide them at design time (ie why not include them at all)??

Dave
0
 

Author Comment

by:Reaver2
ID: 10813163
I have a previous form with checkboxes that determine which fields the user will see in my particular form.  The user just hits a button to open my form, and will only see the fields which they checked off.

I want either to be able to hide fields in form view (so not a design change)
or
disable that SAVE dialog box.  I am tempted to use SetWarnings False.  But I don't want something important to be hidden.  (I have deletions disabled anyway.)

Is there a way to create a form on-the-run based on this form, and make design changes. . .Then delete the form or something when they close it.  (Something that will not make Access worry about saving.)
0
 

Author Comment

by:Reaver2
ID: 10814662
It has been solved:

The ColumnHidden property can be modified during a Form's run-time!  This is NOT a design change!

Thanks a LOT for all your collaboration!
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10848645
Closed, 150 points refunded.
modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question