Close without saving button? (1 Viewer)

nrgu

New member
Local time
Tomorrow, 00:30
Joined
Feb 7, 2010
Messages
4
I have a form that is used to create or update a new table, and 2 buttons, save, and close w/o saving, however I can't seem to make close w/o saving work? The table gets updated as soon as focus changes. I'm not sure how to implement this, any help appreciated :)
 

vbaInet

AWF VIP
Local time
Today, 15:30
Joined
Jan 22, 2010
Messages
26,374
Use the Before Update event of the form and set the parameter 'Cancel' to True if you don't want to save.
 

ericryd

Registered User.
Local time
Today, 09:30
Joined
Jun 24, 2008
Messages
36
vBaInet's way seems easier, but here's the work around I made up... Discard sets a specific field to blank, and then I have a scrub query that runs in a macro to delete any row with that field blank.
 

ghudson

Registered User.
Local time
Today, 10:30
Joined
Jun 8, 2002
Messages
6,195
vBaInet's way seems easier, but here's the work around I made up... Discard sets a specific field to blank, and then I have a scrub query that runs in a macro to delete any row with that field blank.

Why allow the creation of junk records and then have to take the extra steps to clean up something that is preventable?
 

ericryd

Registered User.
Local time
Today, 09:30
Joined
Jun 24, 2008
Messages
36
Why allow the creation of junk records and then have to take the extra steps to clean up something that is preventable?

For me it works as I am logging any time anyone goes to the form and enters data. My way still captures that log.

I'm sure there is a better way, i'm still pretty new to access....

by no means am I saying do it my way, just sharing a work around I use.
 

missinglinq

AWF VIP
Local time
Today, 10:30
Joined
Jun 20, 2003
Messages
6,423
I'm sorry, but I have to agree with ghudson! Ericryd's approach is absurd, and muddying the situation here by posting it is irresponsible and shows a lack of professionalism on his/her part!
 

karysmithers

New member
Local time
Today, 07:30
Joined
Oct 5, 2011
Messages
2
Use the Before Update event of the form and set the parameter 'Cancel' to True if you don't want to save.
Sorry to be blonde but if I want to do this as a macro in the Before Update event what command should i use?
 

vbaInet

AWF VIP
Local time
Today, 15:30
Joined
Jan 22, 2010
Messages
26,374
Welcome to the forum!

I don't use macros but you will need to create a set of conditions. It's easier in code, i.e. Event Procedure.
 

karysmithers

New member
Local time
Today, 07:30
Joined
Oct 5, 2011
Messages
2
Welcome to the forum!

I don't use macros but you will need to create a set of conditions. It's easier in code, i.e. Event Procedure.

Ok thanks, have done so but thought I may be missing something. :)
 

vbaInet

AWF VIP
Local time
Today, 15:30
Joined
Jan 22, 2010
Messages
26,374
No you didn't :) You can use either. VBA is more powerful than macros.

Happy developing!
 

Users who are viewing this thread

Top Bottom