Validating dates in access
Value)) Then Msg Box "Order Complete Dt cannot be null, Please enter date" Ord_Comp_Dt.
Set Focus is Valid = False End If If (Ord_Rcvd_Dt Ord_Comp_Dt.
I am tired that my validation is not working, there are few more validation this one is easiere one its not working properly. It should stop user there unless it enters right date. The situation you described happens because you entered the code on field level.
Secondly I entered the code at form before update event, it worked when I hit the save button but after the message it gives MS message 'You canceled the previous operation' , i guess its bcos of Do Cmd. Product) Then Msg Box "In Ord Doc and In Ord Doc2 must be yes and Product cannot be null." Do Cmd. You should have this code to run on form's before update property!
If only a short range of dates is valid, such as yesterday, today and tomorrow, you can create a drop down list of those dates.
Data validation rules are triggered when a user adds or changes a cell value.If b Value is less than 30 I get the message I asked. hey Visa, i'm not sure why you get the message 'You canceled the previous operation'. Cancel Event command but, I tried it myself and I got no message. In Main Form's before update property you will find the code similar to the code you were using. I don't know y its not working, do we have to change any properties of the field? But you can't exit because it keeps firing the message!After that I get no messages, only the record is still in editing mode as it should be, not allowing to save it before it meets the criterion set before. If b Value is less than 30 I get the message I asked. I used ur code at form level beforeupdate, but nothing happened ,my cursor went to next field, it works only if I hit the save button, so I used the code at field level beforeupadte it works there if I hit tab it fires the trigger when criteria not matched, but issue is that it doesn't allow me to do any changes to be made in Indoc or Indoc2 or product field and continously it fires the message. Why is it not enough for you to check the fields before saving the record? The situation you described happens because you entered the code on field level.To test the data validation, enter a date that is not in the current year.To download the sample file, click here: Data Validation for Dates The zipped file is in xlsx format, and does not contain any macros.
Why is it not enough for you to check the fields before saving the record?