Calculate difference bet currency values

Adigga1

Registered User.
Local time
Today, 14:32
Joined
Oct 2, 2008
Messages
57
Hello everyone,

I have a slight issue I,

I have a Total charge field = $100.50
and i am looking to subtract = $50.50

And present the remaining total in field Surplus = $50.00

unfortunately the following code I have running is returning $100.50; $50.50 and $50.50 respectively. How do I stop the $.50 from carrying over?

Code:
Dim lngTotalCharge As Long
Dim sngECH As Long
If ECH.Text = "" Then
    sngECH = 0
 Else
    sngECH = CSng(ECH.Text)
End If
'delay
TotalCharge.SetFocus
Dim curTotalCharge As Currency
Dim strTotalCharge1 As String
strTotalCharge1 = TotalCharge.Text
If strTotalCharge1 = "" Then
   delay
End If
If strTotalCharge1 = "" Then
  ' delay
End If
If strTotalCharge1 = "" Then
 '  delay
End If
If strTotalCharge1 = "" Then
   'delay
End If
If strTotalCharge1 = "" Then
  ' delay
End If
If strTotalCharge1 = "" Then
 '  delay
End If
If strTotalCharge1 = "" Then
  ' delay
End If
curTotalCharge = CCur(strTotalCharge1)
txtPhysicians.SetFocus
txtPhysicians.Text = CStr(curTotalCharge - sngECH)
Else
txtPhysicians.SetFocus
txtPhysicians.Text = ""
ECH.SetFocus
ECH.Text = ""
TotalCharge.SetFocus
TotalCharge.Text = ""
End If

Thanks in advance

A...
 
For starters:

Dim sngECH As Long

A Long can only hold an integer value, no decimals.
 
For starters:

Dim sngECH As Long

A Long can only hold an integer value, no decimals.


Thanks pbaldy, I will adjust the code and test.

thanks again..

A...
 

Users who are viewing this thread

Back
Top Bottom