Using Query by Table Example for If Then Scenarios

One solution is to use a string of nested IIF functions in an update query. It would look like the following:

IIF([Incurred]>=1 and ([Incurred]<=500,[Level]=1,IIF([Incurred]>=501 and 
[Incurred]<=1000,[Level]=501,IIF([Incurred]>=1001 and [Incurred]<=5000, [Level]=1001,IIF(
[Incurred]>=5001 and [Incurred]<=10001,[Level]=5001, IIF([Incurred]>=10001 and
 [Incurred]<=25000,[Level]=10001, IIF(Incurred]>=25001 and [Incurred]<=50000,[Level]=25001,
 IIF([Incurred]>50000,[Level]=50001 

This solution has ...

Get Access 2002 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.