Hi there
I have a feeling I am going about this in the wrong way but do not know another approach that would work. I need to be able to compare one field's records (of which there are 19 possibilities) to return a value from a field with the same name. The nested iif function was working fine (as below) until I ran out of iifs and Access complained the query was too complex (with which I agree) but I am not sure of what other approach I can take. SQL so far which works fine looks like this: (please forgive as SQL is very new to me!)
SELECT [Labour Available monthly values].Resource, IIf([resource]="site managers",[site managers],IIf([resource]="ass sm",[ass sm],IIf([resource]="RLOs",[RLOs],IIf([resource]="Joiners",[Joiners],IIf([resource]="App Joiners",[Apprentice Joiners],IIf([resource]="Brick Layers",[Brick Layers],IIf([resource]="Labourers",[labourers],IIf([resource]="Drivers",[Drivers],IIf([resource]="Storeman",[Storeman],IIf([resource]="Plasterers",[Plasterers],IIf([resource]="Plaster patchers",[Plaster patchers],IIf([resource]="Wall Tilers",[Wall Tilers],IIf([resource]="Decorators",[Decorators],IIf([resource]="Floorers",[Floorers],0)))))))))))))) AS test, [Base figures for actual monthly updates].[Contract number]
FROM [Base figures for actual monthly updates] INNER JOIN [Labour Available monthly values] ON [Base figures for actual monthly updates].[Contract number] = [Labour Available monthly values].[Contract number];
But I need to add another 5 levels - any ideas or a possible different approach?
I have a feeling I am going about this in the wrong way but do not know another approach that would work. I need to be able to compare one field's records (of which there are 19 possibilities) to return a value from a field with the same name. The nested iif function was working fine (as below) until I ran out of iifs and Access complained the query was too complex (with which I agree) but I am not sure of what other approach I can take. SQL so far which works fine looks like this: (please forgive as SQL is very new to me!)
SELECT [Labour Available monthly values].Resource, IIf([resource]="site managers",[site managers],IIf([resource]="ass sm",[ass sm],IIf([resource]="RLOs",[RLOs],IIf([resource]="Joiners",[Joiners],IIf([resource]="App Joiners",[Apprentice Joiners],IIf([resource]="Brick Layers",[Brick Layers],IIf([resource]="Labourers",[labourers],IIf([resource]="Drivers",[Drivers],IIf([resource]="Storeman",[Storeman],IIf([resource]="Plasterers",[Plasterers],IIf([resource]="Plaster patchers",[Plaster patchers],IIf([resource]="Wall Tilers",[Wall Tilers],IIf([resource]="Decorators",[Decorators],IIf([resource]="Floorers",[Floorers],0)))))))))))))) AS test, [Base figures for actual monthly updates].[Contract number]
FROM [Base figures for actual monthly updates] INNER JOIN [Labour Available monthly values] ON [Base figures for actual monthly updates].[Contract number] = [Labour Available monthly values].[Contract number];
But I need to add another 5 levels - any ideas or a possible different approach?