473,325 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

IIF statement in query....need help please

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.

3 1427
NeoPa
32,556 Expert Mod 16PB
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
yappy77
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
32,556 Expert Mod 16PB
I'm pleased that helped :)
Jul 23 '10 #4

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

Similar topics

14
by: Bruce W...1 | last post by:
I do a query to MySQL using PHP. Well actually I do too many of them which is the problem, it's too slow. I think maybe an inner join or something would be better but I can't figure this out. ...
5
by: Annie | last post by:
hello guys, I have little experience working with C# and MS Access ... I am having an insert query with one datetime field and a boolean and couple of text and number fields as below: ...
10
by: varlagas | last post by:
I execute a query (against DB2 for iSeries), which, in its generic form is as follows. This query runs just fine, executing in a couple of seconds SELECT V.FIELD01, V.FIELD02, V.FIELD03,...
14
by: Tina | last post by:
My employer tracks productivity/performance of clinicians (how much they bill) each week, its averages for the month, and the 6 months. These averages are compared to their expected productivity....
5
by: vinfurnier | last post by:
Hi - I've been struggling to produce a working parameter query that will allow the end user to type in any date (mm/dd/yy) and obtain the records of the previous 2 days. In other words, if the...
2
by: partha das | last post by:
sir i need a single sql query it may be sub query need to retrive the 5th highest salary from a employee table
0
by: Chuck36963 | last post by:
Hi all, I've been working on a listing problem and I can't figure out how to work it out. I have looked far and wide on the web to find answers, but I'd like other peoples input on my project in...
6
by: leeg | last post by:
Help please. Apologies but I am poor in access and programming :o) and am having trouble getting my head around this one!!...again!!! I need to have a query or report to flag up someone who has...
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: id ------------ name
2
by: buddyr | last post by:
example: field1 bblandscape, wallmart, kmart field2 4,6,9 field3 5,7,6 field4 12,0,5 field5 if field2 > field3 then field5 = "Yes" if field4 = 0 then field5 = "Yes"
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.