By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,681 Members | 1,854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,681 IT Pros & Developers. It's quick & easy.

prevent saving when just closing

P: n/a
Hi,

I would like my record to be saved only when my own close button (with all
it's checks) is used.
I made the winodws close button disappear, but you still can close using the
right mouse click.
also when designing, going to design mode saves the record.

So I tried: OnClose : Me.Undo.
My own cancel button uses it and it works ok,
but not in the OnClose event.

how to prevent the record to be saved when just closing.

I hope I could make myself clear...

TIA

Michiel

Jun 27 '08 #1
Share this Question
Share on Google+
7 Replies


P: n/a
"Michiel Rapati-Kekkonen" <nn@nonsense.zzwrote in message
news:ey*************@read4.inet.fi...
Hi,

I would like my record to be saved only when my own close button (with all
it's checks) is used.
I made the winodws close button disappear, but you still can close using
the right mouse click.
also when designing, going to design mode saves the record.

So I tried: OnClose : Me.Undo.
My own cancel button uses it and it works ok,
but not in the OnClose event.

how to prevent the record to be saved when just closing.

I hope I could make myself clear...

TIA

Michiel
Use the form's Unload event instead. It has a parameter called Cancel which
will prevent the form from closing unleass set to True. So you can do your
checks and:

Cancel = True

if the checks fail.
Jun 27 '08 #2

P: n/a
On Jun 5, 1:26*am, "Michiel Rapati-Kekkonen" <n...@nonsense.zzwrote:
Hi,

I would like my record to be saved only when my own close button (with all
it's checks) is used.
I made the winodws close button disappear, but you still can close using the
right mouse click.
also when designing, going to design mode saves the record.

So I tried: OnClose : Me.Undo.
My own cancel button uses it and it works ok,
but not in the OnClose event.

how to prevent the record to be saved when just closing.

I hope I could make myself clear...

TIA

Michiel
just have the form's beforeUpdate event use the same function as your
'close' button
and if there's as validation error, set the event 'cancel' to true or
undo the changes

Jun 27 '08 #3

P: n/a
thank you both for your answers
I didn't find It, yet
but I continue experimenting.

The matter is that someone is allowed to close the form,
but only the information should not be saved if they don't close it 'my way'

michiel
"Michiel Rapati-Kekkonen" <nn@nonsense.zzwrote in message
news:ey*************@read4.inet.fi...
Hi,

I would like my record to be saved only when my own close button (with all
it's checks) is used.
I made the winodws close button disappear, but you still can close using
the right mouse click.
also when designing, going to design mode saves the record.

So I tried: OnClose : Me.Undo.
My own cancel button uses it and it works ok,
but not in the OnClose event.

how to prevent the record to be saved when just closing.

I hope I could make myself clear...

TIA

Michiel
Jun 27 '08 #4

P: n/a
well, I solved it with the BeforeUpdate event.
In that event the info on the form will be wiped away, unless a Boolean is
set to True by my own Close button.

thanks again for your help

michiel
"Michiel Rapati-Kekkonen" <nn@nonsense.zzwrote in message
news:mS**************@read4.inet.fi...
thank you both for your answers
I didn't find It, yet
but I continue experimenting.

The matter is that someone is allowed to close the form,
but only the information should not be saved if they don't close it 'my
way'

michiel
"Michiel Rapati-Kekkonen" <nn@nonsense.zzwrote in message
news:ey*************@read4.inet.fi...
>Hi,

I would like my record to be saved only when my own close button (with
all it's checks) is used.
I made the winodws close button disappear, but you still can close using
the right mouse click.
also when designing, going to design mode saves the record.

So I tried: OnClose : Me.Undo.
My own cancel button uses it and it works ok,
but not in the OnClose event.

how to prevent the record to be saved when just closing.

I hope I could make myself clear...

TIA

Michiel

Jun 27 '08 #5

P: n/a
In article <mS**************@read4.inet.fi>, Michiel Rapati-Kekkonen
<nn@nonsense.zzThu, 5 Jun 2008 12:20:34 writes
>the information should not be saved if they don't close it 'my way'
Why do you want to do it that way rather than let your validation run
when the form closes any way?

I don't think my users would be very happy if they lost their input data
just because they closed the form not via a "Save" button.

It is one of the strengths of Access that it saves data by default.
--
Les Desser
(The Reply-to address IS valid)
Jun 27 '08 #6

P: n/a
On Jun 7, 5:52*pm, Les Desser <NewsDu...@dessergroup.comwrote:
In article <mSQ1k.137$OV1...@read4.inet.fi>, Michiel Rapati-Kekkonen
<n...@nonsense.zzThu, 5 Jun 2008 12:20:34 writes
the information should not be saved if they don't close it 'my way'

Why do you want to do it that way rather than let your validation run
when the form closes any way?

I don't think my users would be very happy if they lost their input data
just because they closed the form not via a "Save" button.

It is one of the strengths of Access that it saves data by default.
--
Les Desser
(The Reply-to address IS valid)
and if there is a validation / business rule error when they try to
'x' out, you should prompted them as to whether they want to throw
away the input, they may want to fix the error(s) prior to exiting
Jun 27 '08 #7

P: n/a
In article
<39**********************************@m36g2000hse. googlegroups.com>,
Roger <le*********@natpro.comSun, 8 Jun 2008 06:42:43 writes
>and if there is a validation / business rule error when they try to 'x'
out, you should prompted them as to whether they want to throw away the
input, they may want to fix the error(s) prior to exiting
I suppose it all depends on the "style" of your application.

All our applications save by default - if the input is valid. If not
valid then they cannot exit until they correct the input or cancel it.

Your suggestion is of course perfectly valid and may be desirable in
some applications.

For a general commercial application, there is no need to keep
confirming every input.
--
Les Desser
(The Reply-to address IS valid)
Jun 27 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.