A 2007... I dont WANT to save changes!

D

derek

Problem .. in an A2007 form I have an OK button that starts out disabled and
gets enabled by code when certain things happen. This is all fine and
according to plan. But whenever I close this form, A2007 asks me if I want
to save changes. If I say YES, the state of the command button is saved as
"enabled". Look I designed it this way for a darned good reason and I don't
want Access changng the design of my forms every time they close, just
because some properties have been changed since they opened. It's just not
logical!

The property "Enable Layout View" is disabled for this database, and the
form property "Allow Layout View" is also set to No.

How can I stop this behavior?

Derek
 
B

Baz

derek said:
Problem .. in an A2007 form I have an OK button that starts out disabled
and gets enabled by code when certain things happen. This is all fine and
according to plan. But whenever I close this form, A2007 asks me if I
want to save changes. If I say YES, the state of the command button is
saved as "enabled". Look I designed it this way for a darned good reason
and I don't want Access changng the design of my forms every time they
close, just because some properties have been changed since they opened.
It's just not logical!

The property "Enable Layout View" is disabled for this database, and the
form property "Allow Layout View" is also set to No.

How can I stop this behavior?

Derek
 
B

Baz

This would normally only happen if you've been designing the form (including
editing the code) while it is open. If you simply open it in form view and
work in form view without either switching to the design view or editing the
code then it will close without trying to save.
 
B

Bob Quintal

Problem .. in an A2007 form I have an OK button that starts out
disabled and gets enabled by code when certain things happen.
This is all fine and according to plan. But whenever I close this
form, A2007 asks me if I want to save changes. If I say YES, the
state of the command button is saved as "enabled". Look I
designed it this way for a darned good reason and I don't want
Access changng the design of my forms every time they close, just
because some properties have been changed since they opened. It's
just not logical!

The property "Enable Layout View" is disabled for this database,
and the form property "Allow Layout View" is also set to No.

How can I stop this behavior?

Derek
The DoCmd.Close statement has an optional parameter to save form
design changes. It does not affect the saving of the data.
DoCmd.Close , , acSaveNo
 
D

derek

Hi Bob--
Yes that's true but I would contest that if "Layout view" is disabled then
changes to design at run-time should be impossible. In A2002 the same code
gives no problem. Looks like I'll have to change thousands of docmd.close
statements.... :-(

Derek
 
D

derek

Baz --

That doesn't seem to be true; I checked. Even starting from a cold boot it
does the same.
If you make it into an MDE or ACCDE it stops doing this -- but then of
course I can't change objects at all.

Derek
 
B

Baz

It would be a mistake to think that this is a general issue with A2007, I've
just tried it without any problem.

Unfortunately I cannot offer any further suggestions as to why it is an
issue for you.

derek said:
Hi Bob--
Yes that's true but I would contest that if "Layout view" is disabled
then changes to design at run-time should be impossible. In A2002 the
same code gives no problem. Looks like I'll have to change thousands of
docmd.close statements.... :-(

Derek
 
D

derek

Hi Baz
Hmmm... interesting. Thanks, I'll keep checking.
Derek

Baz said:
It would be a mistake to think that this is a general issue with A2007,
I've just tried it without any problem.

Unfortunately I cannot offer any further suggestions as to why it is an
issue for you.
 
D

derek

Baz -
I don't know if you are stil monitoring this thread but I've tracked down
the problem a bit further...
It occurs whenever the code assigns an inputmask and format to a control
that previously had no inputmask and format. Furthermore, this is an mdb
database that was converted from A2002. (I don't know if that's important or
not). In A2002 this did not trigger a "Save Changes" dialog. Apparently in
2007 it does.

Happy new year
Derek.


Baz said:
It would be a mistake to think that this is a general issue with A2007,
I've just tried it without any problem.

Unfortunately I cannot offer any further suggestions as to why it is an
issue for you.
 
B

Baz

Hi Derek,

And a Happy New Year to you also.

Unfortunately I do not bear good tidings. I have tried what you say
(including in a database converted from Access 2002) without experiencing
this problem.

Does the problem go away if you comment out the code which sets those
properties?

Baz
 
D

derek

Hello again

Yes it does go away. It's actually a subroutine that is called to set the
properties, and if I make the first line of the subroutine "exit sub" the
problem goes away. I'm sorry I'm not allowed to post code (you're probably
far too busy to look at other people's code anyway) but the function of the
routine is to change international date and currency formats -- something
that did not work correctly in A2002. You probably know that in 2002 when
you specified a "currency" format, it actually got saved internally as
$###,###... etc if you were coding in the US, and as £###,###... etc if you
were coding in the UK. From then on, the app is stuck with that currency
display format, regardless of the regional control panel settings.
Consequently it is necessary to step through all controls on forms, looking
for $### or £### format properties and changing them to "currency". A
similar problem occurs with date formats.
So the subroutine gets passed a form, and loops through all the controls...

Anway I "solved" it by searching and replacing all "docmd.close acform,
______ " statements "docmd.close acform, _______ acsaveno". All 674 of
them!

Cheers
Derek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top