validating two dates against each other

elmop2005

New member
Local time
Yesterday, 19:02
Joined
Feb 9, 2012
Messages
8
i have two dates one is called order date and the other is called date required i need to validate these using a created and coded function. both field are on a form call Orders.

the things that they need to b validated for are:

*the order date must be before the date required
*must be valid dates for example not in he past
*cant be letters must be dates in numbers

also i need to code it so that when it is wrong it clears the date and leaves the cursor in the field.
 
1) Could you not use the Validation Rule on the properties sheets to require "OrderDate" to be in the past and "DateRequired" to be in the future?

For OrderDate:
<=Now()

For DateRequired
>=Now()

2) Why can't the date be in letters? It gets remembered as a number anyway, and you can use the Format property to require it display as a set of numbers. For example, I have a database in which you can type "8 mar" or "08/3" or anything else within reason and it just displays according to the format specified by the properties sheet of the box on the form - usually "08/03/2012". Is there a reason why doing it this way would cause you problems?
 
Just wanted to be clear. Are you placing the values in the form through table or entering it as you get orders?

If you have the values on a table and then need to check them when you view it through the form, then you can use the Form_Current property.

Or if you have it manually entered in, then you will be able to do that in the Field's AfterUpdate or OnLostFocus property.

Hope this helps. If you still have questions post back.
 

Users who are viewing this thread

Back
Top Bottom