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

Conditional Expression in a query

2
I'm so new to this, so you will have to explain every detail to me. Let's say I have field "1" that is populated with either W or B and a second field "2" that is populated with either H or S. If field 1 and 2 = W and H then "Undecided" If field 1 and 2 = B and H then "Non Ex" If field 1 and 2 = B and S then "Ex". Like I said since I'm new I will need you to explain where to place this in the query.

Thanks!
Jan 20 '10 #1
4 4073
ChipR
1,287 Expert 1GB
This page has a section on using IIf in a query, and explains it quite fully.
IIf Function[http://office.microsoft.com/en-us/ac...88531033.aspx]
Jan 20 '10 #2
devmor
2
The link states that is no longer available. I have tried the if statement but it doesn't work. But of course I may not be putting it in the right place. I'm placing it in the criteria of one of the fields.
Jan 20 '10 #3
Hello there is a very simple solution. (You solved the problem asking the question, you just need to translate it into VBA code) The following code will mirror your question.

Here's the code...
Place a command button on your form "cmdDecision" and display the results in a textbox or lable. Or in the "AfterUppdate" of field 2.


Private Sub cmdDecision_Cllick()

If Me.Field1 = "W" and Me.Field2 = "H" Then
txtDecision = ""Undecided" or lblDecision = "Undecided"
ElseIf Me.Field1 = "B" and Field2 = "H" then
txtDecision = "NonEx" or lblDecision = "NonEx"
ElseIf Me.Feild1 = "B" and Field2 = "S" then
txtDecision = "Ex" or lblDecision = "Ex"
End Sub



Best Regards,



Lamar Dixon, Jr.
President
Salient Technologies, LLC
MobileMessageMedia(MCubed)
Jan 21 '10 #4
ChipR
1,287 Expert 1GB
Click the words "IIf Function" in my previous post. It seems the forums have included the last ] in the address of the other link, so you could also click that and delete the bracket off the end.
Jan 21 '10 #5

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

Similar topics

8
by: neblackcat | last post by:
Would anyone like to comment on the following idea? I was just going to offer it as a new PEP until it was suggested that I post it here for comment & consideration against PEP 308. I'm far...
62
by: Reinhold Birkenfeld | last post by:
Hi, after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y which is the same as today's...
2
by: John Kreps | last post by:
(acc 2002) I've got six unbound text boxes on a subform that has a white background. Each of those six boxes has an expression that when true, will change its background from white to another...
1
by: GGerard | last post by:
Hello Is there a way to use a variable in the Conditional Formatting of a Textbox? Example : I want the background of a textbox in a continuous form to change color when the value of...
6
by: Chris Dunaway | last post by:
Consider this code (.Net 2.0) which uses a nullable type: private void button1_Click(object sender, System.EventArgs e) { DateTime? nullableDate; nullableDate = (condition) ? null :...
5
by: paulo | last post by:
Can anyone please tell me how the C language interprets the following code: #include <stdio.h> int main(void) { int a = 1; int b = 10; int x = 3;
2
by: mukesh | last post by:
Can we use expression in default value for a table field for example – IIf(Table-1.field-1=table-2 . field-1, table-1.field-2, 0) Interpretation – If field-1 of table -1 is like/equal to...
4
by: Colin J. Williams | last post by:
It would be helpful if the rules of the game were spelled out more clearly. The conditional expression is defined as X if C else Y. We don't know the precedence of the "if" operator. From the...
15
by: Dan Henry | last post by:
I have run across functions in the Linux kernel's MTD driver that have me scratching my head a bit. The functions have the general form: extern int bar(size_t len, size_t *retlen, unsigned char...
15
by: Nicholas M. Makin | last post by:
I was just thinking that I understood the conditional operator when I coded the following expecting it to fail: int a= 10, b= 20, c= 0; ((a < b) ? a : b) = c; // a=0 a=20; b= 10; ((a < b) ? a...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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...

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.