Using MS Access/Report

Advertisement


Question
Hi,
I work with a report in Access 2000 that I need to change it. I should use three values,361, 362 and 363. As an example, if Tot_num = 133 in this field should be shown 3613. When I open the report it shows me a message that it has a syntax error. Could you tell me what is the problem?

IIf(Left([Tot_num];2)="12";"";"363" & Right([Tot_num];1)),IIf(Left([Tot_num];2)="11";"";"362" & Right([Tot_num];1)),IIf(Left([Tot_num];2)="13";"";"361" & Right([Tot_num];1))

What is "Switch"? Can I use it here in this report?

Regards.

Answer
I'm not sure if your language's version of Office requires you to use semicolons instead of commas, but that could be causing the problem. See this tutorial for help with IIF.

No, you cannot use a SWITCH in this case. That's only available in a module (called a SELECT CASE statement).



Be sure to visit my web site and watch my FREE 2-hour-long Microsoft Access Video Tutorial

Cordially,
Richard Rost
599CD Computer Training

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Richard Rost

Expertise

I am happy to answer any kinds of questions about Microsoft Access - from basic table design to advanced VBA programming. Also, please feel free to check the Access Tips & Tricks section of my web site, and free Access 101 tutorial.

Experience

I am the president of AccessLearningZone.com and 599CD.com. I specialize in Microsoft Access Tutorials. I have been teaching Access in the classroom since 1994, and online since 2002.

Education/Credentials
I am a self-taught Access expert. I have been building databases for clients since the early 90s. You can see a sample of my Access Tutorials on my web site at 599CD.com

©2016 About.com. All rights reserved.