To Long of Criteria

bolson7117

Registered User.
Local time
Today, 16:00
Joined
Sep 1, 2009
Messages
42
Hey all,

I have a problem with a Switch function being to long in my field. :(

I have around 23 different numbers like "000001" in my table CAR1_CAV_LOCINFODETL.AREANBR

This is what i have been doing but if go any more it will not work? I also do not want to show "000000" and "000098" in my query.

AREANBR: Switch([CAR1_CAV_LOCINFODETL].[AREANBR]="000016","Monday Thru Saturday",[CAR1_CAV_LOCINFODETL].[AREANBR]="000017","Monday Thru Saturday",[CAR1_CAV_LOCINFODETL].[AREANBR]="000018","Monday Thru Saturday",[CAR1_CAV_LOCINFODETL].[AREANBR]="000019","Monday Thru Saturday",[CAR1_CAV_LOCINFODETL].[AREANBR]="000001","Monday",[CAR1_CAV_LOCINFODETL].[AREANBR]="000002","Tuesday",[CAR1_CAV_LOCINFODETL].[AREANBR]="000003","Wednesday",[CAR1_CAV_LOCINFODETL].[AREANBR]="000004","Thursday",[CAR1_CAV_LOCINFODETL].[AREANBR]="000005","Friday",[CAR1_CAV_LOCINFODETL].[AREANBR]="000006","Monday And Tuesday",[CAR1_CAV_LOCINFODETL].[AREANBR]="000007","Wednesday And Thursday")
 
First, "000016" isn't a number, its text. Second, you shouldn't create a calculated field with the same name of an existing field (AREANBR). Third, you need to create a new table that holds the values you are currently using for your SWITCH statement. Then, you bring that table into your query, link it to the AREANBR field in CAR1_CAV_LOCINFODETL. The table would look like this:

AREANBR, AREANBRDescription
000001, Monday
000002, Tuesday
.
.
.
000017, Monday Thru Saturday
000018, Monday Thru Saturday

Then you can simply replace that monster of a SWITCH statement with AREANBRDescription.
 
Wow Umm Yea Access 101 I must have skipped that chapter :) Thanks for the hlep!!
 

Users who are viewing this thread

Back
Top Bottom