473,750 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A97 - easiest way to have a look at a value entered into a textbox during the BeforeUpdate event?

MLH
Would like to examine the value entered into a textbox
on an A97 form during the BeforeUpdate event. The
textbox may or may not have had an earlier entry in it
prior to the latest value that is now in the process of
being entered. What's the best way to refer to the
value just typed that is about to update the textbox?
Nov 13 '05
10 2321
MLH
By golly, that sounds like it will work! Here I am looking my butt off
for a built-in function that does this - when a little creativity and
a few lines of code take care of it perfectly well.

Thx Wayne!
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxx

Create a variable (variant) in the declarations section at the top of your form module.

Dim varOldValue as Variant

Set this variable in the Enter event of the control to the current value of the control.

Sub Text0_Enter()
varOldValue = Me.Text0
End Sub

Use this variable in your BeforeUpdate code

Private Sub Text0_BeforeUpd ate(Cancel As Integer)
Dim Response As Integer
Response = MsgBox("Wanna replace the old value (" & varOldValue
& ") with " & Me.Text0 & "?", vbYesNo, "Answer?")
If Response = vbYes Then
Exit Sub
Else
DoCmd.CancelEve nt
Me.Text0.Undo
End If
End Sub


Nov 13 '05 #11

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

Similar topics

4
12841
by: Gene | last post by:
When entering a record in a form, I would like a value in a field of the previous record to be entered automatically into a different field of the current record. Which way should I go? Is it also possible to do this based on criteria from the previous record?
2
8230
by: Terry Bickle | last post by:
Please forgive me for using the wrong term here or there. I'm an old Excel 4 macro guy who didn't convert to VB and I'm tinkering with an Access 2000 DB. I'm sure there is a simple Access 101 answer for this. I have a subform which the user selects an item description from a combo box from a table. I want to obtain the cost for the item (another field in the table) also. I've been able to produce the second data field by rewriting the...
2
6088
by: Mark | last post by:
I am attempting to populate several textbox controls from VBA code. With each attempt, I get the following error: "The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Acess from saving the data in the field." Naturally, I have no BeforeUpdate events or validation rules defined for these fields. If I set
2
14832
by: PC Datasheet | last post by:
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...
0
1002
by: Xaviero | last post by:
I have a textbox in my editItemTemplate within my datagrid. This textbox's autoPostback property is true, so I can do some verfications before the user moves on to the next textbox. My verification is in the datagrid_Load event handler. My problem is that every time i get to the datagrid_load after the user has entered a value, the textbox value is empty. Here are a few more details about my datagrid: -It is contained in a usercontrol....
6
4246
by: MLH | last post by:
Using A97. Want to examine 17-char VIN entered by user. VIN codes are alphanumeric and do not contain Oh's to prevent the confusion that could result if zeros were misread as O's or o's. So, if a user types a 17-char VIN into the textbox that has an Oh in it (lower or upper case) - I would like to change it to a zero during the BeforeUpdate code. So far, I've not been able to accomplish this. I can examine
2
1726
by: deancarstens | last post by:
Hi, I'm a novice with VB and I've written this pretty simple script, but for the life of me, I can't get the last bit of the script to work. It should compare the value entered by the user under the BeforeUpdate event and compare it to the value in the main form. It's doing that just okay, but when I want to reset the value using the original value (from the main form), it seems the BeforeUpdate event prevents me from changing it...
5
3839
by: ApexData | last post by:
I have a bound textbox called txtMyBox with the current string value of "200". Once the user enters the textbox, and while the user is still in the textbox, I would like to check the changed value using a function to see if this changed value exists in a table. If it does, I want do give a Msgbox Warning and restore the original value. I thought that I would require the OnUpdate property of the textbox to do this, but I can't seem t...
5
3232
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used at conventions. I have a main form with two subforms. On the main form, there is a text box that displays the sum of total orders entered in the subform, . I'm trying to create another text box on the main form, that looks at the subtotal...
0
9001
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
8838
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9583
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...
1
9342
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6081
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
4716
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...
1
3323
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
2226
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.