Advanced Conditional Formating

Djblois

Registered User.
Local time
Today, 05:33
Joined
Jan 26, 2009
Messages
598
I am trying to use this formula in conditional formatting and it says that syntax is wrong:

Code:
And(IsNull([tbArrTime]),[tbSchTime]<Date)

What I want the code to do is check if [tbArrTime] is null and [tbSchTime] is less than the Current time. Meaning the Appointment is late.
 
Not sure exactly what you're trying to do, but I believe you want:
Code:
And
[tbArrTime] is null
And
[tbSchTime] < Date

With the assumption that "Date" refers to the VBA function Date() (aka the current system date).
 
Yours doesn't work either. I may be wrong but your formula does not even look right because I use this formula in another conditional format and it works:

Code:
IsNull([tbArrTime])
and that is closer to my syntax. I don't know - maybe there are two forms of syntax you can use in conditional formatting.
 
Sorry, I wasn't paying very close attention to exactly what you're doing. Does this work:
Code:
And
IsNull([tbArrTime])
And
[tbSchTime] < Date

Please note that IsNull() does not use the syntax in your original sample (it only takes 1 argument).
 
Ok. In your original post, you show the word "And" at the beginning of your code. What comes before that?
 
The syntax would be

IsNull([tbArrTime]) And [tbSchTime]<Date()

but you say "[tbSchTime] is less than the Current time" so you need to use Now() rathet than Date().

IsNull([tbArrTime]) And [tbSchTime]<Now()
 
would now take today's date into account also?
 
Yes. Now returns the date and time. Date returns today's date (I think at midnight).
 
As Hero says, Date() will return the current date with a time of midnight, which is why I didn't think it would work in this instance; chances are any appointment is going to show as 'late' when compared to midnight of the same day!
 

Users who are viewing this thread

Back
Top Bottom