If statement with Calculation

reggiete

Registered User.
Local time
Today, 03:56
Joined
Nov 28, 2015
Messages
56
Hello,

i am needing help with a if statement in access2010. Here is my formula which is incorrect, Private Sub Form_Load()
If Loan_Type = "HFS" Or Loan_Type = "HFI" And Final_Rating = "Remediated" Then
Loan_Amount.Value multiply(.0104

I am needing a if statement that meets the criteria and if so then multiply loan amount by .0104
 
I would assume you do not want to modify the Loan Amount multiple times so you would need to display the Loan Amount in an unbound control.
 
Correct once the calc is done it will not be repeated again. Only if the if statements are true then multiply loan amount by .0104
 
Does that mean that this condition:
If Loan_Type = "HFS" Or Loan_Type = "HFI" And Final_Rating = "Remediated" Then
will never be true again when the form loads?
BTW, where do the parens belong?
If (A or B) and C Then
If A or (B and C) Then
 
Yes in the if statememt once the calculation is completed then the calculation will be in a text field, so if that same form is open and there is a number in the text field i specified then i need the if statement to ignore and dont execute the statement......

here is the request i have that im trying to build a if statement for
"""NPV Savings"" to calculate %age when ONLY the following scenario occurs:
Loan Type = HFS or FHA
- If ""Final Rating"" = Defect and
""Final Resolution"" = Remediated
- Calculation
□ Loan Amount (X) .0104 -- this field does not need to be displayed in queues - only in Master Report --- calculation to only be assigned to 1st finding of loan number not subsequent findings w/ same loan number"
 
Are you trying to add 4% to the Loan Amount? Is it to be permanently in the table or temporarily for this form?
 
I'm sorry to ask so many questions but you can see it is not so simple.
 
no not 4% but to multiply loan amount by 0.0104 and yes to be permanent in a table. For example, if loan amount is 72k * 0.0104 would equal 748.8 which is the NPV for the loan which would be the value in the text field labeled NPV on a specified form.
 
so conclude, if all the if conditions are true, then take the loan amount in a text box and multiple by 0.0104
 
[Loan Amount] = ([Loan Amount]).0104
would modify the table field [Loan Amount]
 
ok now how would i write that in a if statement and the loan amount will not change... the value from the loan amount * .0104 will be in a text box called NPV ... to conclude, I need a if statement that goes like
If Loan_Type = "HFS" Or Loan_Type = "FHA" And Final_Rating = "Defect" And Final_Resolution = "Remediated" Then

After the then i am not sure how to perform the Loan Amount Value in a text and multiply time .0104 and whatever is that value to place it in a text box labeled NPV
 
Code:
If [Loan_Type] = "HFS" Or [Loan_Type] = "HFI" Then
  If [Final_Rating] = "Defect" and [Final Resolution] = Remediated Then
     [NPV]  = [Loan Amount] .0104
  End If
End If
...maybe...:p
 
does it need to be brackets when you are writing code in VBA?
 
Only if there are embedded spaces in the name. I use them to differentiate between Controls on a form and [Fields] in a table.
 

Users who are viewing this thread

Back
Top Bottom