473,386 Members | 1,743 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,386 software developers and data experts.

IIf statements

76
Hello,

I have a series of IIf statements that return a number based on what value is displayed. I have multiple types of "European Workload" items that can appear. How can I change the IIf statement below to return [Text42] whenever any one of the European Workload items appear? Possible using a wildcard?
Heres the formula:

=IIf([Type]="European Workload Index",[Text42],"1")

Thanks,

Charlie
Nov 21 '06 #1
8 2404
cyberdwarf
218 Expert 100+
Hi,

Are [type] and [text42] database fields, or form fields?

Steve
Nov 21 '06 #2
ckpoll2
76
Steve,

Thanks for responding. I'm not sure if I'm familiar with the terminology that you used (I'm still new to Access), so I'll describe what the text boxes are. [Type] is a field that is stored in a table. This table is what feeds the report for which I'm working on the IIf statement.

[Text42] is a dlookup function that sits on the report. It is not tied to any table (that is, the figure in [Text42] is not stored anywhere). It performs a dlookup from a query that is tied to a table.

As stated in my earlier post, I need an IIf statement that will give me [Text42] when [Type] is "European Workload" and then any combination of words or letters after "Workload", otherwise return a 1. I feel like it has something to do with "*" but I've tried a lot of different things and I can't seem to get it to work.

Thanks,

Charlie
Nov 21 '06 #3
Killer42
8,435 Expert 8TB
Try this
Expand|Select|Wrap|Line Numbers
  1. =IIf([Type] Like "European Workload *",[Text42],"1")
Or, if what I read here today is correct, you might need to try this version...
Expand|Select|Wrap|Line Numbers
  1. =IIf([Type] Like "European Workload %",[Text42],"1")
(Just uses % rather than *)
Nov 21 '06 #4
NeoPa
32,556 Expert Mod 16PB
I'm not sure what you read Killer, but I've found that T-SQL (for MS SQL) requires the '%' but Access usually works with '*'.
I would guess the '%' is more standards compliant.
Other, more Standards Compliant SQL engines would probably favour the '%' too.
Nov 21 '06 #5
ckpoll2
76
Thanks for your help everyone.

One problem I ran into with this: when what appears is just "European Workload" with nothing after it (which does sometimes happen) it gives me a "1". Is there any way that I can alter the equation so that it gives me [Text42] when "Type" is "European Workload" or it's "European Workload 9901"?

Thanks again,

Charlie
Nov 27 '06 #6
NeoPa
32,556 Expert Mod 16PB
Thanks for your help everyone.

One problem I ran into with this: when what appears is just "European Workload" with nothing after it (which does sometimes happen) it gives me a "1". Is there any way that I can alter the equation so that it gives me [Text42] when "Type" is "European Workload" or it's "European Workload 9901"?

Thanks again,

Charlie
Yes there is.
Expand|Select|Wrap|Line Numbers
  1. =IIf([Type] Like "European Workload*",[Text42],"1")
This doesn't require the extra space at the end of the line and will therefore match "European Workload".
Nov 27 '06 #7
ckpoll2
76
You all are great. Thanks for all your help.
Nov 27 '06 #8
Killer42
8,435 Expert 8TB
=IIf([Type] Like "European Workload*",[Text42],"1")
This doesn't require the extra space at the end of the line and will therefore match "European Workload".
Yeah, that's my goof - sorry.
Nov 27 '06 #9

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

Similar topics

6
by: Bart Nessux | last post by:
Should an if statement have a corresponding else statement? Or, is it OK to have an if statement by itself. For completeness, it seems the two should be together, but from experience I know that a...
9
by: Jaime Wyant | last post by:
I know I've seen this somewhere, but can't seem to google it. Is there a way to use an alternate statement separator, other than the default ';'? jw
1
by: Tom D | last post by:
I'm rewriting a database interface that our company currently has. Currently it's using the Pear::DB interface, but we found that that was introducing a bit too much overhead. I'm rewriting the...
39
by: slogging_away | last post by:
Hi - I'm running Python 2.4.2 (#67, Sep 28 2005, 12:41:11) on win32, and have a script that makes numerous checks on text files, (configuration files), so discrepancies can be reported. The script...
0
by: Fuzzyman | last post by:
Hello all, The following is a copy of a blog entry. It's asking a question about future statements and the built in compile function. I'd appreciate any pointers or comments about possible...
20
by: Neroku | last post by:
Hello, i would like to know what the serious definition of statements and expressions is: i know an expression are evaluated to a value, i.e: 1 == 2 5+7 foo( 1,2) and a statement is...
2
by: ojorus | last post by:
Hi! Some questions regarding the mysqli-extension (php5) 1) Prepared statements: If I understand things right, prepared statements will give better performance if you make several similar...
3
by: Dmitri | last post by:
Hello! I have a developer that is playing around with some SQL statements using VB.NET. He has a test table in a SQL 2000 database, and he has about 2000 generated INSERT statements. When the...
0
by: Gary Herron | last post by:
Ohad Frand wrote: There is no way you can consider 'elif', 'else', 'except', and 'from' statements. However, as someone pointed out, the kwlist from the keyword module is the closest thing we...
0
by: Ohad Frand | last post by:
Hi Thanks a lot for your reply I think the main uses for it is to study the language and to see that I didn't miss anything else or that something is changed from one version to another. The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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?
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:
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,...

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.