IIF/OR function togerher-not work

G

Guest

Dear All


I try to use IIF and OR functions together, it does work well at MS Excel as
follow

=IF(OR(C1="CC",C1="ZD",C1="CE"),C1&"_"&D1,C1)

I try to implement it at MS Access 2000 as below, but it does not work
...always have error message said that “ Syntax error(comma) in query
expressionâ€
Date Col"B" Col"C" Col"D"
1/01/2007 CC Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
2/01/2007 CD Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
3/01/2007 CE Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
9/01/2007 CC Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
11/01/2007 CD Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
23/01/2007 CE Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
4/01/2007 ZD Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
5/01/2007 ZW Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)

Would any one can help me to fix this expression?

Thanks a lot for your help,

Best Regards

PA
 
D

Douglas J. Steele

Access is quite different than Excel in this regard.

IIF((="CC" OR ="ZD" OR ="CE"),&"_"&[C],)
 
G

Guest

Dear All,

Thanks alot..It solve my problem..

Thanks very much

Best Regards

PA

Chris2 said:
PA said:
Dear All


I try to use IIF and OR functions together, it does work well at MS Excel as
follow

=IF(OR(C1="CC",C1="ZD",C1="CE"),C1&"_"&D1,C1)

I try to implement it at MS Access 2000 as below, but it does not work
..always have error message said that “ Syntax error(comma) in query
expressionâ€Â
Date Col"B" Col"C" Col"D"
1/01/2007 CC Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
2/01/2007 CD Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
3/01/2007 CE Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
9/01/2007 CC Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
11/01/2007 CD Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
23/01/2007 CE Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
4/01/2007 ZD Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
5/01/2007 ZW Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)

Would any one can help me to fix this expression?

Thanks a lot for your help,

Best Regards

PA


PA,

Is OR a function for Access/VBA like it is in Excel?

I don't think it is.

I thought OR and XOR were operators in VBA.

Set a reference to the MS Excel Object Reference Library, and see if
it works then.


Sincerely,

Chris O.
 
C

Chris2

PA said:
Dear All


I try to use IIF and OR functions together, it does work well at MS Excel as
follow

=IF(OR(C1="CC",C1="ZD",C1="CE"),C1&"_"&D1,C1)

I try to implement it at MS Access 2000 as below, but it does not work
..always have error message said that “ Syntax error(comma) in query
expressionâ€
Date Col"B" Col"C" Col"D"
1/01/2007 CC Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
2/01/2007 CD Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
3/01/2007 CE Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
9/01/2007 CC Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
11/01/2007 CD Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
23/01/2007 CE Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
4/01/2007 ZD Notcoded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)
5/01/2007 ZW Coded ='IIF((OR(="CC",="ZD",="CE"),{B}&"_"&[C],)

Would any one can help me to fix this expression?

Thanks a lot for your help,

Best Regards

PA


PA,

Is OR a function for Access/VBA like it is in Excel?

I don't think it is.

I thought OR and XOR were operators in VBA.

Set a reference to the MS Excel Object Reference Library, and see if
it works then.


Sincerely,

Chris O.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top