SQL code help please

Bradon

Board Regular
Joined
Dec 18, 2002
Messages
66
I want to use a macro that collects data with a range of data entries that range from 8p, 8q, through to 8z.

I have tried the code:

[table1]![Yeargroup]="8p" Or [table1]![Yeargroup]="8q" Or [table1]![Yeargroup]="8r" Or [table1]![Yeargroup]="8s" Or [table1]![Yeargroup]="8w" Or [table1]![Yeargroup]="8x" Or [table1]![Yeargroup]="8y" Or [table1]![Yeargroup]="8z"

This works but with one more entry it is too long for the condition box.

Any suggestions as to how to shorten it?

Thanks
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
What do you mean too long?

You should be able to add another condition but you might not be able to see the whole expression.

By the wat have you tried the Between or In operators, or putting the criteria in seperately?
 
Upvote 0
When I tried to add an extra one it brought up a message box saying it was too long.

What is the syntax for "between" ?
 
Upvote 0
Never seen that error message.

Maybe

[table1]![Yeargroup] Between "8p" And "8z"

By the way you don't need to set the criteria in one expression like that.

You can use the rows and columns in the query design view for Or/And. Sorry but I can't remember which is And and which is Or.
 
Upvote 0

Forum statistics

Threads
1,221,905
Messages
6,162,768
Members
451,786
Latest member
CALEB23

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