473,403 Members | 2,293 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,403 software developers and data experts.

How to fix IIF expression

I'm trying to sum volumes in a table, however I have more than one unit of measure (liters and milliliters). I created the following in the 2007 Access Expression Builder, but when I run the query, the /1000 (to take mL to L) does not calculate.
Expand|Select|Wrap|Line Numbers
  1. CONVERT: IIf([UOM]="Milliliter*",[VOLUME]/1000,[VOLUME])
Any suggestions on how to fix?!
May 22 '12 #1

✓ answered by NeoPa

Of course, it may be simpler and more reflective of the logic if you used :
Expand|Select|Wrap|Line Numbers
  1. CONVERT: [Volume] / IIf([UOM] Like 'Millilitre*',1000,1)
As well as reflecting the proper spelling of Millilitre ;-)

9 3571
mshmyob
904 Expert 512MB
Maybe a typo. Why do you have a caret after Milliliter?

cheers,
May 22 '12 #2
Its not a caret, its a * wildcard, in case there is anything after milliliter.
May 22 '12 #3
NeoPa
32,556 Expert Mod 16PB
If it's a wildcard character then you need to use "Like" rather than "=".
May 23 '12 #4
mshmyob
904 Expert 512MB
Then like Neo says you cannot use an equal sign. The qual sign will look for a literal match and by your answer you will never find a record in your table where the column UOM="Milliliter*".

Change the equal sign to the word LIKE as indicated by Neo and see if that helps you.

cheers,
May 23 '12 #5
Expand|Select|Wrap|Line Numbers
  1. CONVERT: IIF ([UOM]LIKE"Milliliter*",[VOLUME])/1000,[VOLUME])
I'm getting an error stating that the expression contains invalid syntax, or you need to enclose your text data in quotes.
Now what?

Thanks for your help mshmyob and Neo
May 23 '12 #6
mshmyob
904 Expert 512MB
That is because there is no statement or expression called [UOM]LIKE"Milliliter*".

Try adding proper spacing like so
Expand|Select|Wrap|Line Numbers
  1. [UOM] LIKE "Milliliter*"
Also I noticed you are missing an opening bracket: ie: you have one "(" and two ")".

cheers,
May 23 '12 #7
NeoPa
32,556 Expert Mod 16PB
Of course, it may be simpler and more reflective of the logic if you used :
Expand|Select|Wrap|Line Numbers
  1. CONVERT: [Volume] / IIf([UOM] Like 'Millilitre*',1000,1)
As well as reflecting the proper spelling of Millilitre ;-)
May 23 '12 #8
Halleluia! Thank you NeoPa
May 23 '12 #9
NeoPa
32,556 Expert Mod 16PB
Glad to help Ella :-)

PS. A new discussion was triggered from this thread (Discussion: Spelling of Litre).
May 24 '12 #10

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

Similar topics

23
by: Paul Rubin | last post by:
OK, I want to scan a file for lines matching a certain regexp. I'd like to use an assignment expression, like for line in file: if (g := re.match(pat, line)): croggle(g.group(1)) Since...
70
by: Roy Yao | last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ? According to my analysis, operator sizeof, (type) and * have the same precedence, and they combine from right to left. Then this...
22
by: Tony Johansson | last post by:
Hello Experts! I'm reading i a book about C++ and they mention infix with telling what it is. I hope you out there can do so. Many thanks! //Tony
2
by: Mike Turco | last post by:
I like using the expression builder for a lot of different things but it isn't always available when I want to use it, for example in the code window, or in all of the control properties. I am...
14
by: John Temples | last post by:
Given this code: extern volatile unsigned char v; int main(void) { v; return 0; }
15
by: Nerox | last post by:
Hi, If i write: #include <stdio.h> int foo(int); int main(void){ int a = 3; foo(a); }
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
1
by: lovecreatesbea... | last post by:
---quoting--- Annex C (informative) Sequence points 1 The following are the sequence points described in 5.1.2.3: - The end of a full expression: an initializer (6.7.8); the expression in an...
28
by: Marc Gravell | last post by:
In Linq, you can apparently get a meaningful body from and expression's .ToString(); random question - does anybody know if linq also includes a parser? It just seemed it might be a handy way to...
18
by: dspfun | last post by:
Hi! The words "expression" and "statement" are often used in C99 and C- textbooks, however, I am not sure of the clear defintion of these words with respect to C. Can somebody provide a sharp...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.