UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Validation Rule For Date And Time Field, Access 2016    
 
   
marcuscatan
post Jan 23 2020, 02:47 PM
Post#1



Posts: 15
Joined: 20-January 20



Hello all!

The date fields in my form are in the "01/01/2020 05:50" format, it was a requirement because they believe it is faster for our workers to input data in the forms (instead of separate date and time fields).

I was able to get a nice Input Mask which is working flawlessly, but less so for my validation rule.

My current validation rule is: Is Null Or (>=#01-Jan-20# And <= Date())

This rule will only allow me to type in today's date if it's midnight (23/01/2020 00:00) if I pass one minute after that (23/01/2020 00:01) the rule already blocks it.

I tried (>=#01-Jan-20# And <= (Date() + 0,9999) ) believing it would let me input any time before tomorrow but it hits wrong syntax.

Can anyone please help me with a rule that works?

Last obs.: As it was a project requisition, I cannot separate the date and time fields.

Thanks a lot laugh.gif
Go to the top of the page
 
theDBguy
post Jan 23 2020, 03:00 PM
Post#2


UA Moderator
Posts: 77,506
Joined: 19-June 07
From: SunnySandyEggo


Hi. If the data has time component, then why not try adding time components in your validation rule as well? For example:

CODE
Is Null Or (>=#01-Jan-20# And <= Date() + #23:59:59#)

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
marcuscatan
post Jan 23 2020, 03:25 PM
Post#3



Posts: 15
Joined: 20-January 20



I didn't know how to crazy.gif, that's why I tried adding it as it would work in excel formulas

Your solution did it, thank you very much!!!! yayhandclap.gif
Go to the top of the page
 
theDBguy
post Jan 28 2020, 02:38 AM
Post#4


UA Moderator
Posts: 77,506
Joined: 19-June 07
From: SunnySandyEggo


Hi. You're welcome. Sorry for the delay. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    21st February 2020 - 10:08 AM