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

How to return the new value entered into a control onchange?

16
Hi all,

I have a problem with a form that I'm developing at work and would love any assistance so I'm not wondering all night!

I have 3 fields, dateA, dateB and dateC.

dateA and dateB contain 2 separate dates. dateC is empty by default.

The user is supposed to enter a date in dateC that falls between the dates in A and B. I have already written the script to compare a given date value with dateA and dateB to make sure it meets the requirements.

I want the check to occur as soon as the user picks a date with the date picker, before they can tab to another cell etc (this is the last field on the form and if I wait, they might hang up on the customer they are talking to before they realise th date is invalid if I don't trigger it immediately)

My problem is that I can't find how to get the value of the new value dateC so that I can compare it.

I am using the following, triggered by the onchange property.

dim earlydate as date
dim latedate as date
dim prefdate as date

earlydate=me.dateA.value
latedate=me.dateB.value
prefdate=me.dateC.value

This returns a runtime error - invalid use of null. So it is setting prefdate to the old value of the cell rather than the new value that the user entered to trigger the onchange event. Is there any way to get the new value rather than the old value, so I can dim the value and start to use it??

Many thanks!
Jan 19 '11 #1
1 3803
Tim F
16
I resolved this by adding an onchange event to DateC that just said me.DateC.setfocus. That entered the new value and let me use an AfterUpdate event to trigger my actual code, using me.undo to cancel the entry in DateC if it didn't meet my parameters.

So effectively as soon as a value is entered, the code was triggered to check whetehr that value was correct, before the user could leave the field.
Jan 19 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Lee | last post by:
I am using a modal window and an iFrame to try and pull a return value back. I am doing this across domains. I have the value returned from the modal window to the iFrame window but I can not...
1
by: Glen Welsh via AccessMonster.com | last post by:
I am trying to set a control to equal the last value entered for that control on the previous form. In other words: I have a control called HullNumber, which will remain constant for approximately...
10
by: MLH | last post by:
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...
17
by: hplloyd | last post by:
Hi, I have a function that adds data to a database and I want to return true if the database was updated and false if there was a problem, so I am using a try... catch block... My problem is...
2
by: Srinivasan | last post by:
I want to include javascript confirm inside the Button_Click even procedure and contine the process based on the user selection. The real problem is how to assign javascript confirm return value to...
11
by: randomtalk | last post by:
hi, i have the following recursive function (simplified to demonstrate the problem): >>> def reTest(bool): .... result = .... if not bool: .... reTest(True) .... else: .... print...
6
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...
20
by: lovecreatesbeauty | last post by:
Hello experts, Is the following code snippet legal? If it is, how can exit() do the keyword return a favor and give a return value to the main function? Can a function call (or only this...
1
by: =?Utf-8?B?QmlzaG95?= | last post by:
Hi all, I have an asp.net 2.0 web site with a DetailsView control to select and insert data from database. I made the insert statement for that DetailsView by a stored procedure. I made some...
1
by: Rob | last post by:
Hi, I am using a databound web control (infragistics webgrid) whose dataobject's delete row property is set to run a particular method in the Business Logic Layer. Before calling the Data Access...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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.