How to calculate due date

computerminimum

New member
Local time
Today, 09:00
Joined
Apr 10, 2012
Messages
3
Hi guys,

i am totally lost when it comes to this....

The question request i do an update query to calculate the due date field.

i am given the loan date, the return date and the loan period for three diffrent books and their fines.

so i started off by finding the Latedays which is [Loan date] - [returned date]

then i want to fine the overdue amount and then use that to find the due date

I'm I on the right track?

Thank You
Computerminimum
 
First, an update query is never (by never I mean 95% of the time) the right answer. Second, storing a calculated value is absolutely never (99% of the time) the right answer.

Third, in plain english, without using field names or database jargon, tell us how you would calculate a due date if computers had never been invented.
 
Not quite.
i am given the loan date, the return date and the loan period
To calculate due date, add loan period (which I am assuming is in days) to the loan date.
DueDate = DateAdd("d", LoanPeriod, LoanDate)
To calculate days late, subtract the ReturnDate from the DueDate.
DaysDiff = DateDiff("d", DueDate, ReturnDate)
DaysLate = IIf(DaysDiff > 0, DaysDiff, 0)

DateDiff subtracts date1 from date2. If the result is greater than 0, the book was returned late. If the result is negative, then the book was returned before it was due and so you need to make DaysLate zero.
 
Not quite.

To calculate due date, add loan period (which I am assuming is in days) to the loan date.
DueDate = DateAdd("d", LoanPeriod, LoanDate)
To calculate days late, subtract the ReturnDate from the DueDate.
DaysDiff = DateDiff("d", DueDate, ReturnDate)
DaysLate = IIf(DaysDiff > 0, DaysDiff, 0)

DateDiff subtracts date1 from date2. If the result is greater than 0, the book was returned late. If the result is negative, then the book was returned before it was due and so you need to make DaysLate zero.

Thanks much.. i'll try doing that
 

Users who are viewing this thread

Back
Top Bottom