A C/C++ developer since 2000, doing SQL, Ms-Access and MS-Office projects since 2007. Since 2011 moving to the exciting world of Business Intelligence. Located in Sydney, Australia, and a mother of three kids.
25 February 2010
Save changes to the following objects?
Aboout a year and a half ago we changed from using Access (full version) to Access 2007 runtime. It is cheaper (no need to install new Access on each user machine) and it is safer (I can control which objects do the users see) but it is more sensitive, so errors that I didn't have in Access 2003 full version appear all of a sudden in the runtime version. Access 2003 is simply more forgiving, especially if you tell it to load without openeing the database window. It is kind of horrible: you do something, test it, and after uploading the changes the users complains. The following error was in particular weird since I know it was tested in the Access 2007 runtime.
Another pain is to test it & develop on the same machine: each time you change version a prompt comes up with "installing...." which takes at least one minute of my precious time.
So today, after uploading the new version, my users complaint of the following error while hitting the "close" button of a form:
A form appears (see picture) asks you to save the forms. We are talking about users, not developers, and since when can you save changes in Access 2007 runtime?
I thought it was due to the multi user environment, but running a test version from my machine (for which I am obviously the only user) replicated the same problem.
The problem resulted from the following piece of code:
Private Sub Form_Current()
If get_se_listed(Me.pl_security) <> 0 Then
Me.pl_trade.DecimalPlaces = 0
Else
Me.pl_trade.DecimalPlaces = 2
End If
End Sub
Changing the decimal places (an option which is usually done in design time only, and not at run time) resulted in the definition of the form changing as well, and that prompts for the "save" problem. Goggling the issue had left me with only one (!) post about it in the forums, right here.
So first I eliminated the new changes, otherwise the users, non violent people in general, might kill me by the end of the day.
I decided to try and test for myself wheather prompting it not to save on close would actually work:
I added the code for the event "form_close" asking kindly to close without saving
docmd.close acForm, "sub_form_name", acSaveNo
It worked in Access 2003 but it didn't work in Access 2007 runtime version. At lease when I pressed the "no" it prompt me for saving (Again!) but didn't end up with a nasty "Execution for this application has stopped due to a run-time error" which I'm all to familiar with.
Adding the code to the form and not only to the sub_form had not helped. This time it did crash eventually.
In order to avoid the crash you can press 'Yes' and you can press 'No' but do not press 'Cancel'!
Also don't put the line
docmd.close acForm, "form_name", acSaveNo
or acSaveYes in the parent form name.
Trying to play with the Form_current event led to the conclusion that only for an empty function
Private Sub Form_Current()
End Sub
I wouldn't get the prompt. Please note that the form default view is in Datasheet. But I do need the design!
Subscribe to:
Post Comments (Atom)
I have the same problem. It also occurs with the Access 2007 full version, not only with the runtime version.
ReplyDeleteTo reproduce the problem:
Create a new form with a textbox control and set the default view of the form to Datasheet. In the Form_Load event procedure write e.g.:
Text0.Format = "Standard"
Save and close the form.
Then open the form normally by double-clicking it and close it. The following message occurs:
"Do you want to save changes to the design of form 'Form1'?"
The error does not occur with an MDE/ACCDE/ADE.