Go Back   PCMech Forums > Help & Discussion > Software Discussion & Support

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 10-01-2003, 10:38 AM   #1
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
Access CASE WHEN statement

In SQL Server you can use a CASE WHEN statement to SELECT different values conditional on values in the row data.

Is there an equivalent in Access?

Cheers

DJ
dj4uk is offline   Reply With Quote
Old 10-01-2003, 11:12 AM   #2
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
Not that I know of. However, if you describe what you are trying to do perhaps a workaround can be found.
doctorgonzo is offline   Reply With Quote
Old 10-01-2003, 11:15 AM   #3
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
OK if a field Sold is True then PriceString should be returned as 'SOLD'.

If a field Awaiting_Release is True then PriceString should be returned as 'AWAITING RELEASE'.

Otherwise PriceString should return the value in the field Price.

DJ
dj4uk is offline   Reply With Quote
Old 10-01-2003, 11:33 AM   #4
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
The good thing about Access queries is that you can use all of the VB stuff. In this case, I think two IIf statements will work nicely:

SELECT IIf([Sold]=True,"SOLD",IIf([Awaiting_Release]=True,"AWAITING RELEASE",[Price])) AS PriceString FROM ....

Add whatever other columns you may need. You don't say if it is possible for both Sold and Awaiting_Release to be simultaneously true; if not, then this will work as written. If so, it may be more complicated.
doctorgonzo is offline   Reply With Quote
Old 10-01-2003, 11:34 AM   #5
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
Excellent I just found the IIf statement myself. Thanks again for you suggestions.

DJ
dj4uk is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:27 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2