Multiply a currency field with code

dan1dyoung

Registered User.
Local time
Today, 08:15
Joined
Apr 9, 2005
Messages
76
Currently i have:

If CIS = False Then
CIS_Payment = "£0.00"
Else
CIS_Payment = "£20.00"
End If

which works ok but what i want to do but do not know the correct way/syntax is:

If CIS = False Then
CIS_Payment = "£0.00"
Else
CIS_Payment = "Labour_Total*18/100"
End If

Where CIS_Payment and Labour_Total are currency fields, and CIS is a checkbox updated using an update query with the same info as detailed in another table (Couldnt get the conditions to work referencing the checkbox in the other table, so duplicated the box in both tables and used a query to sync)

Any ideas???
 
If Labour_Total is the actual name of the field:

CIS_Payment = Labour_Total * 18 / 100

If you want it returned as a string variable like you are showing the other field:

CIS_Payment = cStr(Labour_Total * 18 / 100)
 
If CIS_Payment is a currency field, why are you putting strings into it? Both "£0.00" and "£20.00" are strings. Your code should use simply 0 and 20 respectively.
RichO showed you how to perform the calculation. You were trying to set the field to a string. ANYTHING enclosed in qotes is a STRING. It will not be seen as an expression.
 

Users who are viewing this thread

Back
Top Bottom