473,396 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Creating Save, Cancel and Exit Commands to protect form data

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
2 11838
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
2
by: icedgar | last post by:
am using the following script in the BeforeUpdate area of a main form. Private Sub Form_BeforeUpdate(Cancel As Integer) Dim strMsg As String strMsg = "Do you wish to save your changes?" If...
2
by: superseed | last post by:
Hi, I'm pretty new to C#, and I'm quite stuck on the following problem. I would like to add to my application a Windows.Form (singleton) on which I could display a message of one of the...
0
by: Patty05 | last post by:
I have a datagrid on a form that update properly when form loads. When the program runs and I type in/add a new row in the datagrid, it does not save the changes. Any help would be greatly...
2
by: rockdc1981 | last post by:
I dont it is possible to put this codes together.. I want to prompt the user to save the record and at the same time have a log of audit trail. the codes work out fine separately. Code for Audit...
1
by: OxfordConsult | last post by:
I have a form and it is to creat a 'link' between a project and a company. Creating a record form this table will simply create a record in a databse with the company ID and project ID. Project ID is...
2
by: KC-Mass | last post by:
I have a form that is used to ID and then load Excel files into Access. I use labels on the form to record which file was last loaded. That was accomplished with a simple lblFileLoaded =...
5
by: snehadulur | last post by:
In the input box if we click ok or cancel the invoice prints. By default the credit card info is 0, and most of the cases its 0 even when we want to take a print out i.e., the value is changed. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.