If Statement Unbound Text Box

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hmiller@hartford.edu

    #1

    If Statement Unbound Text Box

    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.

  • Bob Quintal

    #2
    Re: If Statement Unbound Text Box

    "hmiller@hartfo rd.edu" <hmiller@hartfo rd.edu> wrote in
    news:1130617214 .141078.315310@ g47g2000cwa.goo glegroups.com:
    [color=blue]
    > 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.
    >[/color]
    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.

    Comment

    • hmiller@hartford.edu

      #3
      Re: If Statement Unbound Text Box

      Thanks for the help Bob.

      Comment

      Working...