Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cost and time Access 2000

Status
Not open for further replies.
Apr 19, 2000
73
US
I have a form/subform linked by account number. My main form(customers) has these fields:
ACCOUNT(primary key)
CUSTOMER(text)
ADDRESS(text)
My subform (trouble tickets) has these fields:
TICKETNUMBER(primary key)
ACCOUNT(linked to main form)
TROUBLE(memo)
DATE(short date)
CALLTIME(number)(user enters number of minutes on call)
CALLCOST(currency).

Problem 1: need to auto calculate (on current?) the CALLCOST field when CALLTIME is entered but am not sure of the code to do this.Here's what i need it to do:
If CALLTIME is 1 to 15 minutes then CALLCOST is $50.00
If CALLTIME is from 15-30 minutes then CALLCOST is $80.00
If CALLTIME is over 30 minutes then CALLCOST is $100.00 plus an additional $20.00 for every 15 minutes after.

Problem 2: How do I put a field in which will calculate the total call cost for just the current month for each customer in the subform? (so everytime I move to another customer in the mainform the field in the subform displays total billed for the current month for that customer)

 
You need someething like the following on your subform's OnCurrent event and in Calltime's AfterUpdate event

Code:
If Calltime < 15 then
    CallCost = 50
ElseIf Calltime between 15 and 30 then
    CallCost = 80
ElseIf Calltime >= 30 then
    CallCost = 100 + (Int((Calltime-30)/15)*20)
Else
    CallCost = 0
End If

This code assumes both CallTime and CallCost are numeric fields, and that CallCost is formatted as currency.

HTH [pc2]
 
can you help some more. It doesn't seem to work still.
The Calltime between 15 and 30... is that >15<30 in vb?

Also the CallCost = 100 + (Int((Calltime-30)/15)*20) isn't calculating and I'm still new at vb to know if this snippet is correct for what I need.
Everything in the calltime field larger than 30 in increments of 15 will add 20 to the callcost. So if the calltime number is 31 thru 45 then callcost will be 120, if the calltime number is 46-60 then the call cost is 140 and so on and so on.
Thanks in advance.


&quot;I love you guys&quot;-- Evil Parallel Universe Eric Cartman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top