Code werkt niet

Status
Niet open voor verdere reacties.

Segers

Gebruiker
Lid geworden
29 sep 2010
Berichten
30
Private Sub txtComm_LostFocus()

' Commissie is prijs per eenheid * comm (bv. 0.5) / 100 * eenheid
txtTComm = ((txtPCts * txtComm) / 100) * txtcarts

End Sub

Private Sub txtPCts_LostFocus()

'als het een aankoop betreft dan
If txtSort = "purchase" Then
' font kleur = blauw
txtCarats.ForeColor = vbBlue
txtTotal1.ForeColor = vbBlue
txtTotal2.ForeColor = vbBlue
'uiteindelijke waarde berekenen3.
txtTotal1 = txtCarats * txtPCts
txtTotal2 = txtTotal1 / txtRate
'absolute waarde weergeven
txtTotal1 = Abs(txtTotal1)
txtTotal2 = Abs(txtTotal2)
ElseIf txtSort = "sale" Then
txtCarats.ForeColor = vbRed
txtTotal1.ForeColor = vbRed
txtTotal2.ForeColor = vbRed
txtTotal1 = txtCarats * txtPCts
txtTotal2 = txtTotal1 / txtRate
txtTotal1 = -(Abs(txtTotal1))
txtTotal2 = -(Abs(txtTotal2))
End If


End Sub


Kan er iemand helpen?
 
Zoiets:
txtTComm = ((me.txtPCts *me.txtComm) / 100) * me.txtcarts

Jan
 
Om te beginnen: graag code opmaken met de code tag. En verder geef je niet aan wat het probleem is. De oplossing van Jan is op zich al netter als wat je zelf hebt gemaakt (je refereert nu beter naar de objecten op je formulier) maar de uitkomst zou hetzelfde moeten zijn, of de code nu werkt of niet. Leg dus op zijn minst het probleem uit...
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan