I'm trying to write a code for following senario,
A customer may be offered "rebates" each time the machine is used per month,
Example
1-200 $0.70
201-500 $1.00
500-9999 $1.20
If a customers machine did 525 transactions in the month,
This means for the transaction upto 200 for the month they will receive $0.70 a get (200 x $0.70 = $140) the next 300 transactions (201-500) will get $1.00 (300 x $1.00 = $300) and 25 transactions (501-525) will get $1.25 (25 x $1.25 = $31.60) there the customer will earn $140 + $300 + $31.60 = $471.60.
my code
Private Sub Rebate_KeyPress(KeyAscii As Integer)
Dim result As Integer
Select Case result
Case Form_CustomerF.Total <= 200
result = Form_Customer.Total * 0.7
Form_CustomerF.Rebate = result
Case Form_CustomerF.Total >= 201 And Form_CustomerF.Total <= 500
result = Form_Customer.Total - 201 + 140
Form_CustomerF.Rebate = result
Else
result = Form_Customer.Total - 501 * 1.2 + (300 + 140)
End Sub
so what this does is examine data from form and inputs the value to rebate field. Im not sure why its not working and im losing hair :banghead:
Any help will be appreciated
A customer may be offered "rebates" each time the machine is used per month,
Example
1-200 $0.70
201-500 $1.00
500-9999 $1.20
If a customers machine did 525 transactions in the month,
This means for the transaction upto 200 for the month they will receive $0.70 a get (200 x $0.70 = $140) the next 300 transactions (201-500) will get $1.00 (300 x $1.00 = $300) and 25 transactions (501-525) will get $1.25 (25 x $1.25 = $31.60) there the customer will earn $140 + $300 + $31.60 = $471.60.
my code
Private Sub Rebate_KeyPress(KeyAscii As Integer)
Dim result As Integer
Select Case result
Case Form_CustomerF.Total <= 200
result = Form_Customer.Total * 0.7
Form_CustomerF.Rebate = result
Case Form_CustomerF.Total >= 201 And Form_CustomerF.Total <= 500
result = Form_Customer.Total - 201 + 140
Form_CustomerF.Rebate = result
Else
result = Form_Customer.Total - 501 * 1.2 + (300 + 140)
End Sub
so what this does is examine data from form and inputs the value to rebate field. Im not sure why its not working and im losing hair :banghead:
Any help will be appreciated
