How to avoid the prompt "save changes to form..." in Access 2007 when you have changed someting in Datasheet View?

Posted on 2010-09-06
Medium Priority
Last Modified: 2013-11-28
I have an Access 2007 application running a 2003 MDB.
When users are changing the column layout in datasheet view (adding/removing columns), they are asked if they would like to save changes when closing the form. This was not the case in access 2003.
How do I stop this prompt, I seem not to able to intervene before the standard prompt "Save chages to the form" is coming?
If I could intervene I wolud be happy to give the users the possibility to store their sepsific datasheet layout, but then I would like to give a more understandable question....
Question by:Joar
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
  • 4
  • 3
  • 2
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33614147
Please be clear...
What "Format" is this database in?

The Access 2007 format (.accdb) or the 2003 format (.mdb)

Be very careful when running Access 2003 format databases under Access 2007.
There are many changes that are Access 2007 specific, that users may be able to make that may cause issues down the line.

1. IMHO, you want the message to always appear.
I was always prompted to save changes like this in Access 2003, so I could not reproduce your issue of Access 2003 NOT asking to save design changes to a tables.
(This seems suspicious in and of itself though, and should be investigated.)

Can I ask why you are allowing users to add/remove columns?
This should be a developer task...

Or you can use a Form with the Default View property set to "datasheet View".
(not allow the users direct access to a table)
Then you can create an interface that asks then what columns that want displayed before opening the form, to avoid this issue altogether.


LVL 44

Accepted Solution

GRayL earned 2000 total points
ID: 33614193

If you close the form from VB, use this line:

DoCmd.Close acForm "frmName", acSaveNo

Author Comment

ID: 33615372
To boag2000:
I said the db format was 2003 mdb....
This client have been running Access 2003 for years, and now upgraded to Access 2007, while I as a developer upgarded to 2007 some years ago.
I am a bit anxious of converting from mdb to accdb because of all the rewriting of code I expect?

In my app users are allowed to switch from form to datasheet view.
I am not allowing users to add/remove columns in the table, just hiding/unhiding columns in the datasheet view.
Access 2003 didn't ask for saving changes in the form if you did hide/unhide, while Access 2007 does.
Thats the problem, because it is annoying the user.
I understand your advice is to write a special interface to solve this problem.
May be its a good solution, but are you sure this will surpress the save prompt?

To GRavL:
Where shall I put this docmd.close code, if the user closes the window or closes the entire application? Do I have to substitute the standard close-icons (the X in the upper right corner) with a close button? I have tried all the events in the form and noen of them do execute before the "Save changes.." comes.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33615730
In your original post you stated:
    When users are changing the column layout in datasheet view (adding/removing columns) they are asked if they would like to save changes when closing the form.

Now you say:
    I am *not* allowing users to add/remove columns in the table, just hiding/unhiding columns in the datasheet view.

So you can see why I was confused originally.

So again, if you created a form to allow them to select the columns to display before the form opens, then this may solve the issue also.

But I think GrayL has the most straightforward solution.



Author Comment

ID: 33737869
Understand, when I said add/remove I ment inhide/hide.
I see that your solution is one way to go.
But my customers are using this datasheet method in many forsms and then I have to write special "datasheet" form for each form in the application or write some intelligent form handling all forms?

May be I will try the GrayL method
LVL 44

Expert Comment

ID: 33738685
If you had a button cmdClose on the form, in the Click event of the button

Private Sub cmdClose_Click()
 DoCmd.Close acForm "frmName", acSaveNo
End Sub

substitute your real form name for "frmName"

Author Comment

ID: 33741140
Thank you! seems to be the solution!

Author Closing Comment

ID: 33741148
LVL 44

Expert Comment

ID: 33747409
Thanks, glad to help.

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

777 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