473,406 Members | 2,713 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,406 software developers and data experts.

Forms and cancelling updates

Hi All

I'm trying to add an Save/Cancel feature to my forms so that users can
make changes and then reverse them if they so decide.

I've disabled the close button and blocked the Alt-F4 combination so
that the only way to exit the form is to the use the Save/Cancel
buttons

The Save button is straight-forward using DoCmd.Close....

However, the Cancel button is proving to be a bit of a pig. I'm using
ideas from
http://support.microsoft.com/?kbid=197103
but it doesnt mention a Cancel so I'm using

MsgBox("Do you want to save?", vbInformation + vbYesNoCancel, "Save
Record")

The Yes/No is easy to do, but the vbCancel response is not. As one of
the guys says in
http://www.experts-exchange.com/Data..._20810844.html

"if you close the form and hit Cancel and the record is in reality
saved. " ... "in the meantime you will get the message box but if you
hit no you will be stuck with the record that was saved when you hit
cancel."

Does anyone have any ideas on how to implement a decent cancel
rountine?

Thanks in advance

Sam
Nov 12 '05 #1
1 1586
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Seems easy to me:

const strMSG = "Do you want to save?"

dim intAnswer as integer

intAnswer = MsgBox(strMSG, vbInformation + vbYesNoCancel)

Select Case intAnswer
Case vbYes
DoCmd.RunCommand acCmdSave
Case vbNo
Me.Undo
Case vbCancel
' Don't do anything
End Select
If Cancel is selected - that means cancel the save and cancel close -
in effect - Don't Do Anything.

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQAwuPYechKqOuFEgEQKfegCfWabiRAjNRe2LFoq8qPiQbm bB0cUAoIt5
/S21b/pu47hctjfyqbpPieWA
=OlBD
-----END PGP SIGNATURE-----
Samuel Hon wrote:
Hi All

I'm trying to add an Save/Cancel feature to my forms so that users can
make changes and then reverse them if they so decide.

I've disabled the close button and blocked the Alt-F4 combination so
that the only way to exit the form is to the use the Save/Cancel
buttons

The Save button is straight-forward using DoCmd.Close....

However, the Cancel button is proving to be a bit of a pig. I'm using
ideas from
http://support.microsoft.com/?kbid=197103
but it doesnt mention a Cancel so I'm using

MsgBox("Do you want to save?", vbInformation + vbYesNoCancel, "Save
Record")

The Yes/No is easy to do, but the vbCancel response is not. As one of
the guys says in
http://www.experts-exchange.com/Data..._20810844.html

"if you close the form and hit Cancel and the record is in reality
saved. " ... "in the meantime you will get the message box but if you
hit no you will be stuck with the record that was saved when you hit
cancel."

Does anyone have any ideas on how to implement a decent cancel
rountine?

Thanks in advance

Sam


Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul THompson | last post by:
I have been working for some time to 1) detect tab and shift tab events 2) control the focus on the basis of these events. I have found that I can do this, but continue to have nagging problems. ...
8
by: InvisibleDuncan | last post by:
I have a ListView that populates some fields whenever the user selects an item. However, if they change the data in the fields and then select a new item without saving, I want to display a message...
2
by: Greg T | last post by:
Hi, I have a rather long form that I don't want people submitting unless they are absolutely sure they are ready. I figured the easiest way to prevent an accidental form submission by way of...
25
by: Steve Jorgensen | last post by:
Yup, Steve's full of tips, but hey, it makes him feel important, right? Ok, here goes. I've been trying to improve encapsulation by putting code in the same object as the stuff it affects, so I...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
11
by: DW | last post by:
I've gotten this question a couple of times in interviews and I don't know what they are looking for: How do you update a control's property, such as a textbox.text property, from a thread, in...
22
by: Jordan S. | last post by:
SQL Server will be used as the back-end database to a non trivial client application. In question is the choice of client application: I need to be able to speak intelligently about when one...
3
by: jarnie | last post by:
I am attempting to make a form which has alpha transparency that varies across the form, similar to the Adobe splash screens and launchy: http://www.launchy.net/images/screenshot_sheep.jpg ...
0
by: twigboy | last post by:
Hi everyone, I have a strongly typed dataset, with my main form having a datagridview that is binded to an access database. The main form has three buttons one to create a new entry in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.