Access

From Wiki
Jump to: navigation, search

IF Statement Queries

Sum(IIF([Name]="Tom" And [Statement]="Primary",[Value],0))

Switch

Query Formula

Switch (OwnerID=1, "Table", OwnerID=2, "Desk", OwnerID=15, "Mirrow")
returns: 
     "Table", if the OwnerID field is 1.
     "Desk", if the OwnerID field is 2.
     "Mirrow", if the OwnerID field is 15.

SQL Statement

SELECT Switch(OwnerID=1,"Table",OwnerID=2,"Desk",OwnerID=15,"Mirrow") AS Expr1
FROM Orders

http://webcheatsheet.com/SQL/access_functions/Switch.php

Misc

Convert Number to Text

QuantityText:Cstr([Quantity])