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

IIF statement in query....need help please

P: 37
The following is my IIF statement in my query:
Expand|Select|Wrap|Line Numbers
  1. BuyerName: IIf([BuyerCode]="12W",“Buyer_Name”,IIf([BuyerCode]=“12U”,“Buyer_Name”,IIf([BuyerCode]=“12M”,“Buyer_Name”,IIf([BuyerCode]=“12X”,“Buyer_Name”,IIf([BuyerCode]=“12P”,“Buyer_Name”,IIf([BuyerCode]=“12D”,“Buyer_Name”,IIf([BuyerCode]=“EXC”,“NO_BUYER”,IIf([BuyerCode]=“FGT”,“FREIGHT”,“NA”))))))))
Buyer_Name will be substituted with an actual name when the statement is working correctly.

When I paste it into the query, access changes it to this and when I try to run it, it asks me for the parameter value--"12W", etc.:
Expand|Select|Wrap|Line Numbers
  1. BuyerName: IIf([BuyerCode]=[“12W”],[“Buyer_Name”],IIf([BuyerCode]=[“12U”],[“Buyer_Name”],IIf([BuyerCode]=[“12M”],[“Buyer_Name”],IIf([BuyerCode]=[“12X”],[“Buyer_Name”],IIf([BuyerCode]=[“12P”],[“Buyer_Name”],IIf([BuyerCode]=[“12D”],[“Buyer_Name”],IIf([BuyerCode]=[“EXC”],[“NO_BUYER”],IIf([BuyerCode]=[“FGT”],[“FREIGHT”],[“NA”]))))))))
What can I do to get this to work?

Any help would be appreciated as quickly as possible.

Thanks,
MS
Jul 23 '10 #1

✓ answered by NeoPa

As you can see now the code is posted within the code box, some of the quote characters you are using are not quote characters at all, but special characters used by word processors to display quotes in text so that they are slanted.

This usually occurs when using a word processor to work on your SQL. This is never a good idea.

I'm sure if you switch to using the correct characters (Use NotePad or any other text editor) your problems will (at least mainly) disappear.

Welcome to Bytes!

PS. See also Quotes (') and Double-Quotes (") - Where and When to use them for working with quotes.

Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,310
As you can see now the code is posted within the code box, some of the quote characters you are using are not quote characters at all, but special characters used by word processors to display quotes in text so that they are slanted.

This usually occurs when using a word processor to work on your SQL. This is never a good idea.

I'm sure if you switch to using the correct characters (Use NotePad or any other text editor) your problems will (at least mainly) disappear.

Welcome to Bytes!

PS. See also Quotes (') and Double-Quotes (") - Where and When to use them for working with quotes.
Jul 23 '10 #2

P: 37
Thanks so much for your help. It worked and I will keep in mind your tip for using Notepad in the future.
Jul 23 '10 #3

NeoPa
Expert Mod 15k+
P: 31,310
I'm pleased that helped :)
Jul 23 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.