473,396 Members | 1,771 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.

IF/then statement in access query

Im trying to create an if then statement in the expression builder. I have a query that has 2 Columns that have currency values in them.

I want to set up a new column that basically uses the lesser value between the two columns. So it would state if field A < Field B, use Field A, If false use Field B. I want this lesser value to be found in column 3.

Thanks in advance for any help. Im sure this is easy but i have had no luck doing it.
Sep 1 '10 #1

✓ answered by Stewart Ross

The in-line IF (otherwise known as an IIF statement) is used in an Access query; there is no If..Then statement in the Access SQL implementation.

You can enter the following directly into the query grid's field name (quicker in this case than using the expression builder):

Expand|Select|Wrap|Line Numbers
  1. Lowest Value: IIF([Field A] < [Field B], [Field A], [Field B])
-Stewart

2 5962
Stewart Ross
2,545 Expert Mod 2GB
The in-line IF (otherwise known as an IIF statement) is used in an Access query; there is no If..Then statement in the Access SQL implementation.

You can enter the following directly into the query grid's field name (quicker in this case than using the expression builder):

Expand|Select|Wrap|Line Numbers
  1. Lowest Value: IIF([Field A] < [Field B], [Field A], [Field B])
-Stewart
Sep 1 '10 #2
Got it!
Thank you Stewart
Sep 1 '10 #3

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

Similar topics

1
by: Brian Jorgenson | last post by:
Is it possible to add a If-then statement in a query? For example, If field B is greater then field A, then field B = something else. I am creating a class schedule. My class size's are 5 people...
1
by: Sreeneet | last post by:
Hi all, I want to call a stored procedure which is written in SQL Server from an ms-access query. It is having some parameters also and the stored procedure will return some records. Is there...
1
by: beconrad | last post by:
Hi all, I have an if then statement coded as an after update event procedure on a data entry form. It works perfectly on an Access 2000 database, but when I try the same query on an Access 2002...
2
by: Dave Harrington | last post by:
Hi all - I got a pretty basic question that's been bugging me today. I'm using ASP.NET, C# and MS Access for a database driven application. I have a datagrid that will populate based on a...
12
by: zwasdl | last post by:
Hi, I'm using MS Access to query against Oracle DB via ODBC. Is it possible to use HINT in Access? Thanks, Wei
19
MSeda
by: MSeda | last post by:
I would like to use a Global variable as a criteria in an access query. in my first attempt to do so I wrote a Function that looks like this Public Function GloVar(ByVal VarName) As String ...
3
by: Idlemind23 | last post by:
Ahoy! I'm hoping for some help on what (I believe) should be a simple task. I have a form with a button. I would like that button to have a caption with a date. That date should be pulled out...
1
by: cryptotech2000 | last post by:
What I am looking to do is create an if then statement for a particular access query, here are the facts Tables used Mainframe Report List Fields Within the table that are used for the if...
2
by: Aussie Rules | last post by:
Hi, I have a access 2007 database with a cross tab query. Based on the selection critieria the cross tab may contain a different number columns in the result. For example if the query is...
13
by: curious80237 | last post by:
In Access 2003: A table with four yes/no fields is part of a query used as data source for a report. The yes/no fields show in the datasheet and the report as checkboxes; the default value of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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,...
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,...

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.