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

Creating Save, Cancel and Exit Commands to protect form data

P: n/a
Hi All,

I want to create following command buttons on a Form which users can
edit.

Save ( Save Changes made)
Cancel ( Undo data changes)
Exit ( Close form)

I am using Macros for each of these commands and they work perfect.
Now I want to do following.

Step 1. Form Opens with only 'Exit' button visible

Step 2. On Dirty 'Save' and 'Cancel' are made visible, 'Exit'
disappears

Step 3. If we click 'Save' ; Form Data is saved; 'Save' and 'Cancel'
disappear; 'Exit' is visible
OR
If we click 'Cancel' , Form Data changes are not saved (Undo); 'Save'
and 'Cancel' disappear; 'Exit' is visible

Step 4. Back to Step 1

I do not know VBA scripting so please suggest me how this can be done
using Macros.

Cheers, Matuag

May 17 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 16 May 2007 23:04:13 -0700, Matuag <ma****@gmail.comwrote:

There is no need for these buttons.

Save: is automatic. Or click the recordselector if you're showing it.
Or move to the next record. Or close the form. Save will happen.

Cancel: use the Esc button.

Exit: Ctrl+F4, or click the X in the upperleft corner of the form.

You remind me of people who insist of implementing their own MoveNext,
MovePrevious, MoveFirst, MoveLast, and New buttons, and ignore the
fact that the navigation buttons already do that. Access is meant to
be a highly productive development environment, and that works best if
you use the tool the way it was designed to be used.

If you ignore the above and still badly wanted to do this, I doubt it
could be done with macros. A2007 macros are somewhat more powerful,
but VBA still reigns supreme.

-Tom.
>Hi All,

I want to create following command buttons on a Form which users can
edit.

Save ( Save Changes made)
Cancel ( Undo data changes)
Exit ( Close form)

I am using Macros for each of these commands and they work perfect.
Now I want to do following.

Step 1. Form Opens with only 'Exit' button visible

Step 2. On Dirty 'Save' and 'Cancel' are made visible, 'Exit'
disappears

Step 3. If we click 'Save' ; Form Data is saved; 'Save' and 'Cancel'
disappear; 'Exit' is visible
OR
If we click 'Cancel' , Form Data changes are not saved (Undo); 'Save'
and 'Cancel' disappear; 'Exit' is visible

Step 4. Back to Step 1

I do not know VBA scripting so please suggest me how this can be done
using Macros.

Cheers, Matuag
May 18 '07 #2

P: n/a
Hi Tom,

Thanks for responding. Perhaps you are right, but I wanted to avoid
saving changes made unknowingly on the form while exiting.

I could finally do this using macros in MS Access 07 and it seems to
work the way I wanted.

I removed Control Box and Record Selectors from MyForm. Then I created
"Save", "Cancel" and "Exit" buttons.

MyForm Properties Event
On Load
Setproperty Save,Visible,0
Setproperty Cancel,Visible,0
Setproperty Exit,Visible,1
On Dirty
Setproperty Cancel,Visible,1
Setproperty Save,Visible,1
Setproperty Exit,Visible,0

Save Properties Even
On Click
SetProperty Cancel, Visible, 0
RunCommand SaveRecord
SetProperty Exit,Visible,1
GoToControl Exit

Cancel Properties Even
On Click
SetProperty Save, Visible, 0
RunCommand Undo
SetProperty Exit,Visible,1
GoToControl Exit
Exit Properties Even
On Click
Close, ,No
On Got Focus
SetProperty Save,Visible, 0
SetProperty Cancel,Visible,0

This allow the users to chose between save and cancel for any changes
made while viewing a particular record and forces them to make this
decision before exiting. May be there is a simpler way to do this
using a message box???

Cheers, Mataug

May 18 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.