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.da teA.value
latedate=me.dat eB.value
prefdate=me.dat eC.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!
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.da teA.value
latedate=me.dat eB.value
prefdate=me.dat eC.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!
Comment