Question How do I do that?

Precips1

Registered User.
Local time
Today, 06:11
Joined
Dec 28, 2010
Messages
35
Hiya!

I'm currently in thought mode on how do I do this in Access.

I'm collecting data for tankers coming on site. I'm interested in the date when the tanker arrived and also when it leaves site.

What I then to do is work out how many days the tanker was on site for. (I can do this bit)

The bit I need help on - We get charged 3 different charges depending on how long the tanker was on site for. 1 to 14 days = £70 per day, 15 to 28 days = £60 per day, greater than 28 days = £50 per day.

How is the best way to calculate these costs? I already have a textbox that shows me how many days the tanker on site but I need to know how to work out the cost depending on the on site time.

Hope this explains

Thanks
 
Last edited:
Hiya!

I'm currently in thought mode on how do I do this in Access.

I'm collecting data for tankers coming on site. I'm interested in the date when the tanker arrived and also when it leaves site.

What I then to do is work out how many days the tanker was on site for. (I can do this bit)

The bit I need help on - We get charged 3 different charges depending on how long the tanker was on site for. 1 to 14 days = £70 per day, 15 to 28 days = £60 per day, greater than 28 days = £50 per day.

How is the best way to calculate these costs? I already have a textbox that shows me how many days the tanker on site but I need to know how to work out the cost depending on the on site time.

Hope this explains

Thanks

A question first... if a tanker were on site for 30 days would the calculation be £50 * 30 or would it be (£70 * 14) + (£60 * 14) + (£50 * 2)?
 
Hi,

If a tanker on site for 30 days then you were right in the second part.

(14 * 70)+(14 *60)+(2*50)

Mike
 
You could use something along the lines of;
Code:
Dim HirePeriod As Integer

HirePeriod = [URL="http://www.techonthenet.com/access/functions/date/datediff.php"]DateDiff[/URL] ("d", HireStartDate, ReturnDate)

If HirePeriod <= 14 Then
     HireCharge = HirePeriod  * 70
If HirePeriod >14 And HirePeriod <= 28 Then
     HireCharge = (HirePeriod-14)*60 + 980
Else  
     HireCharge = (HirePeriod-28)*50 + 1820
End If
 
Last edited:

Users who are viewing this thread

Back
Top Bottom