Link to home
Start Free TrialLog in
Avatar of mbbrice
mbbriceFlag for United States of America

asked on

Access Validation Check

I have a form called [Order Entry Control]. One of the fields on this form is the [DeliveryDate] which is pulled from the contract.

I have another form called [Order Form]. One of the fields on this form is called [OrderDate] and this field defaults to the [DeliveryDate]. Another field [CheckLate] is a check box, which the user selects if the order is past the [DeliveryDate]. Both of these can be modified by the user, but if the [OrderDate] is different than the [DeliveryDate] than the [CheckLate] box must be -1.

Both of these forms are open at the same time. The spaces in the form names are correct and I know it is bad naming practice but I am picking up the ball from someone else.

I want to do a afterupdate VBA on [OrderDate] that checks to see if the user has changed the date [so check to see if [DeliveryDate]<>[OrderDate). If they don't equal I want to ask user, "Is this a late order?" If yes then I want to check the [CheckLate] box in the VBA script. If no I want to tell user "Order date can only be changed for Late Orders" and then undo their date change.

I have researched and I just can't figure it out! Way to complex for my level
Avatar of Hamed Nasr
Hamed Nasr
Flag of Oman image

We need a sample database demonstrating the issue with enough records to get the results. Supply the instructions to process the record and the expected output.
If the order date is set to a value later than the delivery date, is it still possible for it NOT to be a Late order?
If it must be a late order then I don't see the value of asking the user the question.  Just set the checkbox.

It seems to me though that you would also need to unset the checkbox if the order date was found to be same as the delivery date.
Avatar of mbbrice

ASKER

Peter57r,

You logic makes sense. How do I make a validation statement that compares two dates on separate forms to see if they are equal? If they match is runs a set value macro to make sure late box is unchecked. if false it runs a set value macro to check the box?

Form one value is [Order Entry Control].[DelieveryDate]
Form two value is [Order Form].[OrderDate]

Macro if true [checkboxtrue]
macro if false [checkboxfalse]
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mbbrice

ASKER

Peter57r

Thanks for educating me on the terminology. The code wasn't as complicated as I thought it would be.

You did a great job explaining the steps to set it up also. I will have to keep your name in mind for future questions.

You seem like you would be good teacher.