473,473 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

IIf problems

1 New Member
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 1647
CaptainD
135 New Member
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 New Member
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
--Grrrrrr--
2 New Member
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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.