View Full Version : Question Newbie and Need Help on Some Formulas


tingwen
09-27-2008, 03:03 AM
Hey guys,

I'm new to the forums and also do not have much experience on Access. However, I'm working on a school project and I should be submitting it in a few days. I am in urgent need of help so please =)

I'm working on a computerized library system for my school project. The library system goes like this:
If you borrow a book, say on 1st September, then you should return it to the library by 8th September. If you're late, for instance, if you return the book only on the 9th, then you have a penalty of 10 cents. One day late, 10 cents. Two days late, 20 cents. And so on. How do I come up with a formula that will automatically calculate how much a library member has to pay if he/she returns the book late?

I have a field for Returning Date in one of my tables.
One of my friends came up with this:
=([today']-[Returning_Date])*0.1

It does work, but if a person does not return the book late, then it will show a negative value. I don't really like it. Any ideas?

Please and thank you.
Your help will be noted under my documentation acknowledgements lol

=)

stopher
09-27-2008, 04:20 AM
You could take a look the IIF function

Good look with your assignment
Chris

raskew
09-27-2008, 11:20 AM
rtndate = #9/10/08#
borrowdate = #9/1/08#
x = iif(rtndate - borrowdate > 7, (rtndate - borrowdate - 7) * 0.10, 0)
? x
0.2

HTH - Bob