Access Formula Query Problems

L

Legacy 306721

Guest
Here is my code:
Code:
Expr: IIf([Table]![Column]<10,"0 - 9",IIf([Table]![Column]<20,"10 - 19",IIf([Table]![Column]<30,"20 - 29",IIf([Table]![Column]<40,"30 - 39",IIf([Table]![Column]<50,"40 - 49",IIf([Table]![Column]<60,"50 - 59",IIf([Table]![Column]<70,"60 - 69",IIf([Table]![Column]<80,"70 - 79",IIf([Table]![Column]<90,"80 - 89",IIf([Table]![Column]<100,"90 - 99",IIf([Table]![Column]<110,"100 - 109","N/A")))))))))))

When I run a Select query on this code, it runs fine - but when I try filtering data, it gives me the error: "Syntax error (missing operator) in query expression 'Expr'."

What is wrong with the code I have?

Thanks.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Problem has been fixed. Apparently Access does not like variable names with spaces in them, so I removed every space in the name I have for Expr.
 
Upvote 0
You could use
Code:
 IIF(Column MOD 10 =0,Column,(Column\10)*10) & " - " & IIF(Column MOD 10 =0,Column+9,(Column\10-(Column MOD 10 <>0))*10-1)
which will work with any positive number.

*AB
1ColumnExpr1001
230 - 9
350 - 9
480 - 9
52120 - 29
63630 - 39
79090 - 99
88580 - 89
93230 - 39
10141140 - 149
11150150 - 159
12233230 - 239
13-50 - 9

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:55px;"><col style="width:62px;"></colgroup><tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0

Forum statistics

Threads
1,221,900
Messages
6,162,691
Members
451,782
Latest member
LizN

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top