473,395 Members | 1,516 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,395 software developers and data experts.

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 14777
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*******************@newsread2.news.atl.eart hlink.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.renaetl> wrote in message
news:eB**************@TK2MSFTNGP09.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*******************@newsread2.news.atl.eart hlink.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
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...
1
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...
1
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...
4
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...
6
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...
4
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...
7
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...
1
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...
2
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...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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,...
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...

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.