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

IIFStatement #Name

418 256MB
My report has a text box called txtFedAmount. Here I am trying to get the total amount of money for federal revenue.

Expand|Select|Wrap|Line Numbers
  1. FieldName      DataType        Description
  2. RevDescr         text              Federal / Local etc
  3. Budget            Currency        dollar amount
I am trying to add the federal amount of revenue portion in txtFedAmount

Expand|Select|Wrap|Line Numbers
  1. =IIf(([RevDescr]) Like “Federal”,Sum([Budget]),"")
But I keep getting #Name? What am I doing wrong?
Jun 10 '09 #1
3 1115
ChipR
1,287 Expert 1GB
"Like" is used in SQL; it's not a valid operator in an IIf statement.
Jun 10 '09 #2
MNNovice
418 256MB
ChipR:

Thanks. I found a solution to this problem. In the event some other novice like myself gets into this rut, here is the solution:

Expand|Select|Wrap|Line Numbers
  1. =Sum(Abs([RevDescr]="Federal") * [Budget])
Jun 10 '09 #3
NeoPa
32,556 Expert Mod 16PB
A bit late to the show here but let me see if I can clear up some misconceptions.

IIf() is a function that can be used from VBA OR SQL. Like is not usable within VBA code, however it is fine within SQL. The formula for a control would be SQL based, therefore Like is fine (in this case).

Abs() returns the absolute (unsigned) value of the passed parameter. The Boolean value TRUE is numerically equivalent to -1, and FALSE to 0, so this will work when the value is exactly equal to "Federal". This is also true for your original usage of Like. Like is misused here. = was the comparator required in these circumstances.

Lastly, to the actual, original problem :
Expand|Select|Wrap|Line Numbers
  1. “Federal” <> "Federal"
Notice the quotes. The one on the left is not using quote characters that are even recognised by Access as such. Hence the error reported.

A more conventional solution (simply fixing the original code) might be :
Expand|Select|Wrap|Line Numbers
  1. =Sum(IIf([RevDescr]='Federal',[Budget],0)
I think I prefer your code though.
Jun 15 '09 #4

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

Similar topics

23
by: stewart.midwinter | last post by:
No doubt I've overlooked something obvious, but here goes: Let's say I assign a value to a var, e.g.: myPlace = 'right here' myTime = 'right now' Now let's say I want to print out the two...
2
by: Ravi | last post by:
My XML looks like: <abc> <def type="apple"> 1 </def> <def type="peach"> 2 </def> <def type="orange"> 3 </def> <def type="banana"> 4 </def> <def type="plum"> 5 </def> </abc>
1
by: discomiller | last post by:
Mario Mueller: Hello *, radiobuttons belong to other radiobuttons by the "name="any_value"" attribut. Thats a fakt. I got the following XML:...
21
by: TheKeith | last post by:
I heard that the name attribute is deprecated in html 4.01 strict. Is it recommended that you use the ID attribute for images along with the getElementById method instead of the old way? Thanks.
12
by: CJ | last post by:
Why won't this work? I am passing the name of the form (I have two that use this validation script) but I keep getting an error. Error reads: "document.which_form.name is null or not an object" ...
11
by: Andrew Thompson | last post by:
I have written a few scripts to parse the URL arguments and either list them or allow access to the value of any parameter by name. <http://www.physci.org/test/003url/index.html>...
1
by: Prasad Karunakaran | last post by:
I am using the C# DirectoryEntry class to retrieve the Properties of an user object in the Active Directory. I need to get the First Name and Last Name as properties. I know it is not supported...
1
by: ivanet | last post by:
Hello everyone, I am trying to use the following Schema but I get the error "src- resolve: Cannot resolve the name 'ValuesList' to a(n) 'element declaration' component." at line 144. I have...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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,...

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.