By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,182 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

If Statement Unbound Text Box

P: n/a
Hope I make my case clear!!!

I have a table with two bound date/time fields.

I want to be able to use an IF statement and DateDiff to return a text
message in an unbound text box. I want to do this all from the control
source of the unbound text box. What I think it should look like is
something like this;

If(DateDiff("d",[Date1],[Date2])) > 5, Then Display "On Time"

I want datediff to subtract the two dates and if the result is greater
then 5 I want my unbound text box to display the words "On Time".

Is this possible, and if so how could I do this. I am no experience
with VBA and am just learning all the quirks to control entry.

Thanks for all your help folks.

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"hm*****@hartford.edu" <hm*****@hartford.edu> wrote in
news:11**********************@g47g2000cwa.googlegr oups.com:
Hope I make my case clear!!!

I have a table with two bound date/time fields.

I want to be able to use an IF statement and DateDiff to
return a text message in an unbound text box. I want to do
this all from the control source of the unbound text box. What
I think it should look like is something like this;

If(DateDiff("d",[Date1],[Date2])) > 5, Then Display "On Time"

I want datediff to subtract the two dates and if the result is
greater then 5 I want my unbound text box to display the words
"On Time".

Is this possible, and if so how could I do this. I am no
experience with VBA and am just learning all the quirks to
control entry.

Thanks for all your help folks.

the IIF function (Immediate IF) is how to do what you want.
IIf(true or false value, value if True, value if false)

So your control source becomes
=IIf(DateDiff("d",[Date1],[Date2]) > 5, "On Time", "")

--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #2

P: n/a
Thanks for the help Bob.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.