Link to home
Start Free TrialLog in
Avatar of iainmacleod
iainmacleodFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Order a Report based on Text values

I have a table that contains a field "Risk" The values in this are either "LOW", "MEDIUM" or "HIGH".
I need to report on this but have HIGH at the top of the report, then MEDIUM etc.

I think I need to add a field in my query that can assign a numeric value dependent on the contents of the Risk field.

Thanks in advance for any help
SOLUTION
Avatar of crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Similarly to @crystal, in SQL:
SELECT 
	foo
	, bar
	, other
	, fields
	, [SortOrder] = CASE [Risk] WHEN 'High' THEN 1 WHEN 'Medium' THEN 2 ELSE 3 END
FROM YourTable

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of iainmacleod

ASKER

Thank you
You're Welcome
Avatar of crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access

you're welcome ~ happy to help
I agree with Crystal.  Defining lookups in a table is generally the best option.
I think I need to clarify that statement.  I was suggesting (as was Crystal) that the RowSource of a combo come from a table or query rather than a value list.  I was by no means advocating for table level lookups which are an abomination.