Use Expression Builder to write a Nested IF Function

J

jy

Hi,

Can anyone help me to convert the following Excel function into an Access
Expression?

IF((TODAY()-[Date_X])<0,"Message 1",IF((TODAY()-[Date_X])<=2,"Message
2","Yes"))

I am not sure how to write a nested function using the Expression Builder.

Really appreciate anyone's help on this! Thks in advance! ;-)
 
B

Brendan Reynolds

Change 'IF' to 'IIF' and 'TODAY()' to 'Date()'.

In Access, 'If' is used in VBA code, but 'IIf' (Immediate If) in expressions
in queries, control source properties, etc.
 
J

jy

Hi Brendan,

I am familiar with the IIF and Date() function. But am unable to link the
two IF() functions together to become a Nested Function. Any ideas? ;-)

Brendan Reynolds said:
Change 'IF' to 'IIF' and 'TODAY()' to 'Date()'.

In Access, 'If' is used in VBA code, but 'IIf' (Immediate If) in expressions
in queries, control source properties, etc.

--
Brendan Reynolds (MVP)

jy said:
Hi,

Can anyone help me to convert the following Excel function into an Access
Expression?

IF((TODAY()-[Date_X])<0,"Message 1",IF((TODAY()-[Date_X])<=2,"Message
2","Yes"))

I am not sure how to write a nested function using the Expression Builder.

Really appreciate anyone's help on this! Thks in advance! ;-)
 
D

Douglas J. Steele

Brendan's suggesting

IIf((Date()-[Date_X])<0,"Message 1",IIf((Date()-[Date_X])<=2,"Message
2","Yes"))


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



jy said:
Hi Brendan,

I am familiar with the IIF and Date() function. But am unable to link the
two IF() functions together to become a Nested Function. Any ideas? ;-)

Brendan Reynolds said:
Change 'IF' to 'IIF' and 'TODAY()' to 'Date()'.

In Access, 'If' is used in VBA code, but 'IIf' (Immediate If) in
expressions
in queries, control source properties, etc.

--
Brendan Reynolds (MVP)

jy said:
Hi,

Can anyone help me to convert the following Excel function into an
Access
Expression?

IF((TODAY()-[Date_X])<0,"Message 1",IF((TODAY()-[Date_X])<=2,"Message
2","Yes"))

I am not sure how to write a nested function using the Expression
Builder.

Really appreciate anyone's help on this! Thks in advance! ;-)
 
J

jy

Hi Douglas and Brendan,

My expression is as below:

Hold Limit: (IIf ( ( Date()- [Max Hold Date] ) <= 0,"EXCEEDED!", IIf (Date()
- [Max Hold Date] )<=2 , "TRIGGERED!", "Yes" ) )

But the error message showed as: "The expression you entered has a function
containing the wrong number of arguments".

Is there anything wrong with my expression?

Thks! ;-)




Douglas J. Steele said:
Brendan's suggesting

IIf((Date()-[Date_X])<0,"Message 1",IIf((Date()-[Date_X])<=2,"Message
2","Yes"))


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



jy said:
Hi Brendan,

I am familiar with the IIF and Date() function. But am unable to link the
two IF() functions together to become a Nested Function. Any ideas? ;-)

Brendan Reynolds said:
Change 'IF' to 'IIF' and 'TODAY()' to 'Date()'.

In Access, 'If' is used in VBA code, but 'IIf' (Immediate If) in
expressions
in queries, control source properties, etc.

--
Brendan Reynolds (MVP)

Hi,

Can anyone help me to convert the following Excel function into an
Access
Expression?

IF((TODAY()-[Date_X])<0,"Message 1",IF((TODAY()-[Date_X])<=2,"Message
2","Yes"))

I am not sure how to write a nested function using the Expression
Builder.

Really appreciate anyone's help on this! Thks in advance! ;-)
 
B

Brendan Reynolds

I think you probably have one parenthesis too many, or one too few, or one
in the wrong place, but I'm having a hard time figuring out just which one!
:-(

This works for me ...

Hold Limit:
IIf(Date()-[TestDate]<=0,"EXCEEDED!",IIf(Date()-[TestDate]<=2,"TRIGGERED!","Yes"))

--
Brendan Reynolds (MVP)

jy said:
Hi Douglas and Brendan,

My expression is as below:

Hold Limit: (IIf ( ( Date()- [Max Hold Date] ) <= 0,"EXCEEDED!", IIf
(Date()
- [Max Hold Date] )<=2 , "TRIGGERED!", "Yes" ) )

But the error message showed as: "The expression you entered has a
function
containing the wrong number of arguments".

Is there anything wrong with my expression?

Thks! ;-)




Douglas J. Steele said:
Brendan's suggesting

IIf((Date()-[Date_X])<0,"Message 1",IIf((Date()-[Date_X])<=2,"Message
2","Yes"))


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



jy said:
Hi Brendan,

I am familiar with the IIF and Date() function. But am unable to link
the
two IF() functions together to become a Nested Function. Any ideas? ;-)

:

Change 'IF' to 'IIF' and 'TODAY()' to 'Date()'.

In Access, 'If' is used in VBA code, but 'IIf' (Immediate If) in
expressions
in queries, control source properties, etc.

--
Brendan Reynolds (MVP)

Hi,

Can anyone help me to convert the following Excel function into an
Access
Expression?

IF((TODAY()-[Date_X])<0,"Message
1",IF((TODAY()-[Date_X])<=2,"Message
2","Yes"))

I am not sure how to write a nested function using the Expression
Builder.

Really appreciate anyone's help on this! Thks in advance! ;-)
 
J

jy

Hi Brendan,

Thanks so much!! It works!! Yippee!! ;-D



Brendan Reynolds said:
I think you probably have one parenthesis too many, or one too few, or one
in the wrong place, but I'm having a hard time figuring out just which one!
:-(

This works for me ...

Hold Limit:
IIf(Date()-[TestDate]<=0,"EXCEEDED!",IIf(Date()-[TestDate]<=2,"TRIGGERED!","Yes"))

--
Brendan Reynolds (MVP)

jy said:
Hi Douglas and Brendan,

My expression is as below:

Hold Limit: (IIf ( ( Date()- [Max Hold Date] ) <= 0,"EXCEEDED!", IIf
(Date()
- [Max Hold Date] )<=2 , "TRIGGERED!", "Yes" ) )

But the error message showed as: "The expression you entered has a
function
containing the wrong number of arguments".

Is there anything wrong with my expression?

Thks! ;-)




Douglas J. Steele said:
Brendan's suggesting

IIf((Date()-[Date_X])<0,"Message 1",IIf((Date()-[Date_X])<=2,"Message
2","Yes"))


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Hi Brendan,

I am familiar with the IIF and Date() function. But am unable to link
the
two IF() functions together to become a Nested Function. Any ideas? ;-)

:

Change 'IF' to 'IIF' and 'TODAY()' to 'Date()'.

In Access, 'If' is used in VBA code, but 'IIf' (Immediate If) in
expressions
in queries, control source properties, etc.

--
Brendan Reynolds (MVP)

Hi,

Can anyone help me to convert the following Excel function into an
Access
Expression?

IF((TODAY()-[Date_X])<0,"Message
1",IF((TODAY()-[Date_X])<=2,"Message
2","Yes"))

I am not sure how to write a nested function using the Expression
Builder.

Really appreciate anyone's help on this! Thks in advance! ;-)
 
Top