A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Making a query that shows a value based on another value.



 
 
Thread Tools Display Modes
  #1  
Old November 19th, 2009, 10:14 AM posted to microsoft.public.access.queries
JAmes
external usenet poster
 
Posts: 904
Default Making a query that shows a value based on another value.

Hi
I have a Query that extracts two fields of data from a table
1. CustomerName (Contains customer name)
2. BuySell (Has either the Word "Buy" or "Sell")

However I wish this query to display CustomerName (As above) but I want it
to display a word based on whether field 2 is the word 'Buy' or the word
'Sell'. So for example if the word 'Buy' is in field 2 then I want the word
'RHS' to be displayed and if the word 'Sell' is in field 2 I want the word
'LHS' to be displyed. I do not need this to save into a table just purely for
looking at in the query.

Is this possible?

Thanks
James
  #2  
Old November 19th, 2009, 10:39 AM posted to microsoft.public.access.queries
RonaldoOneNil
external usenet poster
 
Posts: 345
Default Making a query that shows a value based on another value.

Remove the BuySell column from your query and replace with this in the field
Row

RHS or LHS: IIF([BuySell]="Buy","RHS","LHS)

"james" wrote:

Hi
I have a Query that extracts two fields of data from a table
1. CustomerName (Contains customer name)
2. BuySell (Has either the Word "Buy" or "Sell")

However I wish this query to display CustomerName (As above) but I want it
to display a word based on whether field 2 is the word 'Buy' or the word
'Sell'. So for example if the word 'Buy' is in field 2 then I want the word
'RHS' to be displayed and if the word 'Sell' is in field 2 I want the word
'LHS' to be displyed. I do not need this to save into a table just purely for
looking at in the query.

Is this possible?

Thanks
James

  #3  
Old November 19th, 2009, 10:40 AM posted to microsoft.public.access.queries
RonaldoOneNil
external usenet poster
 
Posts: 345
Default Making a query that shows a value based on another value.

Sorry missed the closing quote

RHS or LHS: IIF([BuySell]="Buy","RHS","LHS")

"james" wrote:

Hi
I have a Query that extracts two fields of data from a table
1. CustomerName (Contains customer name)
2. BuySell (Has either the Word "Buy" or "Sell")

However I wish this query to display CustomerName (As above) but I want it
to display a word based on whether field 2 is the word 'Buy' or the word
'Sell'. So for example if the word 'Buy' is in field 2 then I want the word
'RHS' to be displayed and if the word 'Sell' is in field 2 I want the word
'LHS' to be displyed. I do not need this to save into a table just purely for
looking at in the query.

Is this possible?

Thanks
James

  #4  
Old November 19th, 2009, 11:06 AM posted to microsoft.public.access.queries
JAmes
external usenet poster
 
Posts: 904
Default Making a query that shows a value based on another value.

Worked a treat. Thanks for the help.

"RonaldoOneNil" wrote:

Sorry missed the closing quote

RHS or LHS: IIF([BuySell]="Buy","RHS","LHS")

"james" wrote:

Hi
I have a Query that extracts two fields of data from a table
1. CustomerName (Contains customer name)
2. BuySell (Has either the Word "Buy" or "Sell")

However I wish this query to display CustomerName (As above) but I want it
to display a word based on whether field 2 is the word 'Buy' or the word
'Sell'. So for example if the word 'Buy' is in field 2 then I want the word
'RHS' to be displayed and if the word 'Sell' is in field 2 I want the word
'LHS' to be displyed. I do not need this to save into a table just purely for
looking at in the query.

Is this possible?

Thanks
James

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:20 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.