473,698 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cancel BeforeUpdate and Return To Old Value

In a form/subform I have an unbound combobox in the form header that sets
the value of a field in the subform so that it does not have to be entered
for each record. In the BeforeUpdate event of the combobox I have some code
to check the value against some criteria and if the new selected value fails
the criteria, I cancel the BeforeUpdate event. I need the combobox to return
to its previous value. For example, the current value is MyValue and the new
selected value is NewValue. When the BeforeUpdate event is cancelled, I want
the combobox to return to MyValue. I have tried undoing the combobox and
undoing the form but the combobox continues to display NewValue. If I go to
another record and return back, MyValue is correctly displayed. So how do I
get the combobox to return to MyValue as soon as the BeforeUpdate event is
cancelled?

Thanks for all help!

Steve
Nov 13 '05 #1
2 14820
From October 20, 2005:

http://groups.google.com/group/micro...4a75d8d15ba513

--

Ken Snell
<MS ACCESS MVP>
"PC Datasheet" <no****@nospam. spam> wrote in message
news:F8******** ***********@new sread2.news.atl .earthlink.net. ..
In a form/subform I have an unbound combobox in the form header that sets
the value of a field in the subform so that it does not have to be entered
for each record. In the BeforeUpdate event of the combobox I have some
code to check the value against some criteria and if the new selected
value fails the criteria, I cancel the BeforeUpdate event. I need the
combobox to return to its previous value. For example, the current value
is MyValue and the new selected value is NewValue. When the BeforeUpdate
event is cancelled, I want the combobox to return to MyValue. I have tried
undoing the combobox and undoing the form but the combobox continues to
display NewValue. If I go to another record and return back, MyValue is
correctly displayed. So how do I get the combobox to return to MyValue as
soon as the BeforeUpdate event is cancelled?

Thanks for all help!

Steve

Nov 13 '05 #2
So Undo does not work on unbound controls? I didn't know that but I haven't
used Undo much. One learns something every day.

Thanks, Ken!

Steve
"Ken Snell [MVP]" <kt***********@ ncoomcastt.rena etl> wrote in message
news:eB******** ******@TK2MSFTN GP09.phx.gbl...
From October 20, 2005:

http://groups.google.com/group/micro...4a75d8d15ba513

--

Ken Snell
<MS ACCESS MVP>
"PC Datasheet" <no****@nospam. spam> wrote in message
news:F8******** ***********@new sread2.news.atl .earthlink.net. ..
In a form/subform I have an unbound combobox in the form header that sets
the value of a field in the subform so that it does not have to be
entered for each record. In the BeforeUpdate event of the combobox I have
some code to check the value against some criteria and if the new
selected value fails the criteria, I cancel the BeforeUpdate event. I
need the combobox to return to its previous value. For example, the
current value is MyValue and the new selected value is NewValue. When the
BeforeUpdate event is cancelled, I want the combobox to return to
MyValue. I have tried undoing the combobox and undoing the form but the
combobox continues to display NewValue. If I go to another record and
return back, MyValue is correctly displayed. So how do I get the combobox
to return to MyValue as soon as the BeforeUpdate event is cancelled?

Thanks for all help!

Steve


Nov 13 '05 #3

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

Similar topics

1
2473
by: Dalan | last post by:
Although I have used the code below to suppress the DoCmd cancel action message from appearing on lots of other actions such as preview and print, I have not been able to get to work on a BeforeUpdate Event Procedure. There is nothing elaborate about the event, however, there is an initial message box stating that if one field contains data then a second one must also, and then after clicking okay, the DoCmdMenuItem action box is...
1
519
by: Corrine | last post by:
Is there a way to cancel a change in an option group? The option group still changes to the option clicked on when clicking on the NO button with the following code in the BeforeUpdate event of the option group. If MsgBox("Change?", vbYesNo) = vbNo Then Cancel = True Me!MyOptionGroupName.Undo End If I also tried reversing the Cancel and Undo lines.
1
15993
by: WindAndWaves | last post by:
Goodmorning Gurus Here is another of my questions..... When adding code to a control then access sometimes puts in a couple of 'parameters'. Can anyone tell me what the use of them is. I have never used them, but I would be keen to do so. Here is an example for a control (on a form) called CNW, when I add some code for the BeforeUpdate event, access puts in the following lines. Private Sub CNW_BeforeUpdate(******Cancel As...
4
1826
by: Deano | last post by:
Alot of my forms are bound. I would like to offer a Cancel option so that they can make as many changes as they like and still Cancel out without making any changes. I have one idea of how to do this for new records; tag each record with a boolean value. On clicking OK, these are all set to True and the form closes. If they Cancel the False records are deleted and the form closes.
6
6664
by: Arno R | last post by:
Hi all I come across a 'feature' of Access (2000) that I don't like and would like to disable. I am checking if a value already exists in a table. I a subform I use code like : Private Sub Choice_BeforeUpdate(Cancel As Integer) If <validation on inputted value already in table is true> Then MsgBox "This choice already exists...", vbCritical, "Validation" Cancel = True
4
11533
by: bob bob via AccessMonster.com | last post by:
I'm sure this is a simple one. I have a combo box that, when its data is changed, will trigger a second form to open for input. If the operator declines input, I want the combo box to return to its original value. The on change event is wrong for this, since the new data has already been saved. As I undertand it, the beforeupdate event won't work either, since it applied to the entire form. Would ondirty be the right event to use? ...
7
2512
by: MLH | last post by:
I tried the following code to prevent a checkbox from being updated (going from a value of Null to True, from True to False or from False to True). I was surprised it did not work. Can anyone offer a sensible, logical, insightful reason as to why Microsoft does not want to let programmers stop this event? Private Sub NoOwnerInfoChkBox_Click() If CurrentVehicleJobID = 0 Then
1
2801
by: Richard | last post by:
A shipment of material is received. The shipment contains several items. Each item is assigned an internal tracking number for auditing purposes and further processed. The tracking number is mandatory, unique and non-zero, but _cannot_ be obtained or assigned automatically by Access (due to business rules ). Table A is the receive table Columns: AID, ReceiveDate, CompanyID
2
2931
by: stovertl1 | last post by:
I am checking for null fields in a BeforeUpdate event handler. If I find one, I set Cancel=True, set the focus for the empty text box and exit the event handler. When I return to the form, there is no focus at all. If I press the Tab key, nothing happens. I need to click in a text box to re-establish the focus. I get to the BeforeUpdate Event handler by clicking an AddRecord button which is attempting to execute a GoToRecord acNewRec...
0
8674
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9027
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6518
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 presenter, Adolph Duprť who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.