troubleshooting Question

How to use switch function in Ms Access query

Avatar of Misghina Tekle
Misghina Tekle asked on
DatabasesMicrosoft AccessSQL* Switch
2 Comments1 Solution95 ViewsLast Modified:
Hi, I am coding an ms access database solution for an aluminum fabrication company that needs to calculate aluminum profile for a project based on a measurement that is put in the field [Frame H] and it has to kinds of profiles called "DO" and "BO" respectively and they use 4 and 6.1 for calculating but I have like 30 conditions and Values to evaluate and when I use switch function in my query it brings a problem stating that" The string returned by the builder was too long. The result will be truncated".
So here is the list of code that I use...

Shutter H: Switch([ProfID]="DO",
Switch(
[TypeID]="ITM001",[Frame H]-4,
[TypeID]="ITM002",[Frame H]-4,
[TypeID]="ITM003",[Frame H]-30-4,
[TypeID]="ITM004",[Frame H]-30-4,
[TypeID]="ITM005",[Frame H]-4-50,
[TypeID]="ITM006",[Frame H]-4-50,
[TypeID]="ITM007",[Frame H]-30-4-50,
[TypeID]="ITM008",[Frame H]-30-4-50,
[TypeID]="ITM009",[Frame H]-4,
[TypeID]="ITM010",[Frame H]-30-4,
[TypeID]="ITM011",[Frame H]-4,
[TypeID]="ITM012",[Frame H]-30-4,
[TypeID]="ITM013",[Frame H]-4,
[TypeID]="ITM014",[Frame H]-4),
[ProfID]="BO",
Switch(
[TypeID]="ITM001",[Frame H]-6.1,
[TypeID]="ITM002",[Frame H]-6.1,
[TypeID]="ITM003",[Frame H]-30-6.1,
[TypeID]="ITM004",[Frame H]-30-6.1,
[TypeID]="ITM005",[Frame H]-6.1-50,
[TypeID]="ITM006",[Frame H]-6.1-50,
[TypeID]="ITM007",[Frame H]-30-6.1-50,
[TypeID]="ITM008",[Frame H]-30-6.1-50,
[TypeID]="ITM009",[Frame H]-6.1,
[TypeID]="ITM010",[Frame H]-30-6.1,
[TypeID]="ITM011",[Frame H]-6.1,
[TypeID]="ITM012",[Frame H]-30-6.1,
[TypeID]="ITM013",[Frame H]-6.1,
[TypeID]="ITM014",[Frame H]-6.1),)

Thanks for your help.
Misghina
ASKER CERTIFIED SOLUTION
als315

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros