473,395 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

IIf problems

I am working on a Microsoft Access database for a drug rehab clinic and this is what I need to do.

I need to beable to take DaysSpent and multiply by cost per day to get CostOfStay. What is throwing me off is there are two pricing catagories(ProvService) and I cant figure out how to multiply by each pricing catagory.

Note:when ProvService=02, cost per day is $150, when ProvService=05, cost per day=200

This is my code so far...


CostOfStay: IIf([ProvService]=2,([DaysSpent]*150),IIf([ProvService]=5,([DaysSpent]*200)))

it is just showing #ERROR in the output.

Any ideas for a modifaction in my IIf statement, or am I going about the problem all wrong and using an IIf statement isnt something I should use in this situation.


Thanks in advance
May 15 '06 #1
3 1646
CaptainD
135 100+
IIf works like this. IIf(SomethingToEvaluate, IfTrueValue, IfFalseValue)
You have two IIf's

Try:
Expand|Select|Wrap|Line Numbers
  1. CostOfStay = IIf([ProvService]=2,([DaysSpent]*150),([DaysSpent]*200)))
  2.  
May 15 '06 #2
wlc04
70
I see you're nesting your IIF's, looks like code is okay except that you're missing the final statement in case neither of the iif's are true:


CostOfStay: IIf([ProvService]=2,([DaysSpent]*150),IIf([ProvService]=5,([DaysSpent]*200),SOMETHING GOES HERE))
May 15 '06 #3
Only other thing that might trip you up is the format of the ProvService field. If it is text you'll probably have to put it in double quotes. i.e. "02" or "05".
May 16 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Jim Hubbard | last post by:
Are you up to speed on the difficulties in using the 1.1 .Net framework? Not if you are unaware of the 1,596 issues listed at KBAlertz (http://www.kbalertz.com/technology_3.aspx). If you are...
1
by: 3f | last post by:
Hello; We have made a web application that people can download from our web site and installed on: Windows XP Windows 2000 Professional Windows 2003 Server Windows 2000 Server
5
by: Corky | last post by:
This works: db2 SELECT DISTINCT PROBLEM_OBJECTS.PROBLEM_ID FROM PROBLEM_OBJECTS INNER JOIN PROBLEMS ON PROBLEM_OBJECTS.PROBLEM_ID = PROBLEMS.PROBLEM_ID WHERE INTEGER(DAYS(CURRENT DATE) -...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
0
by: Sergistm | last post by:
Hello World, :D I have a problem that it is making me crazy, I hope you can help me. I'm trying to execute a .exe file with the Procces.Start, and there is no problem when the file is on my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.