hi
i have a problems.
can anyone help to settle this problem?
for exp;
a person will know about their status that he must pay the fines
he borrow my pencil.after 3 days, he must pay the fines.
1 late day, he must pay rm1.
it will also automatically calculate the amount of his fines
please help me to solve this problem...

Recommended Answers

All 3 Replies

Here you are:

Dim LoanDate As Date
Dim LoanDays As Integer
Dim DueDate As Date
Dim DiffDays As Long
Dim Fine As Single
Dim Total As Single

' When loaned
LoanDate = CDate("8.10.2008")
' How many days can be loaned
LoanDays = 3
' When the loan time ends
DueDate = DateAdd("d", LoanDays, LoanDate)
' Amount of fine
Fine = 1.5
' Overtime
DiffDays = DateDiff("d", DueDate, Now)
' Total amount of fine
Total = DiffDays * Fine
' Show msg
MsgBox "Pay me " & Total & " money", vbCritical, "As Soon As Possible"

Not sure if you need all the code. Change date format in CDate() to match your date format.

Thank you for your cooperation...

Hi! If your question is solved, please mark the thread as solved. Thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.