|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (10 bit)
|
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 |
|
|
|
|
|
#2 |
|
Professional gadfly
|
Not that I know of. However, if you describe what you are trying to do perhaps a workaround can be found.
|
|
|
|
|
|
#3 |
|
Member (10 bit)
|
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 |
|
|
|
|
|
#4 |
|
Professional gadfly
|
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. |
|
|
|
|
|
#5 |
|
Member (10 bit)
|
Excellent I just found the IIf statement myself. Thanks again for you suggestions.
DJ |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|