If statement with Calculation (1 Viewer)

reggiete

Registered User.
Local time
Today, 12:52
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
 

RuralGuy

AWF VIP
Local time
Today, 13:52
Joined
Jul 2, 2005
Messages
13,825
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.
 

reggiete

Registered User.
Local time
Today, 12:52
Joined
Nov 28, 2015
Messages
56
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
 

RuralGuy

AWF VIP
Local time
Today, 13:52
Joined
Jul 2, 2005
Messages
13,825
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
 

reggiete

Registered User.
Local time
Today, 12:52
Joined
Nov 28, 2015
Messages
56
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"
 

RuralGuy

AWF VIP
Local time
Today, 13:52
Joined
Jul 2, 2005
Messages
13,825
Are you trying to add 4% to the Loan Amount? Is it to be permanently in the table or temporarily for this form?
 

RuralGuy

AWF VIP
Local time
Today, 13:52
Joined
Jul 2, 2005
Messages
13,825
I'm sorry to ask so many questions but you can see it is not so simple.
 

reggiete

Registered User.
Local time
Today, 12:52
Joined
Nov 28, 2015
Messages
56
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.
 

reggiete

Registered User.
Local time
Today, 12:52
Joined
Nov 28, 2015
Messages
56
so conclude, if all the if conditions are true, then take the loan amount in a text box and multiple by 0.0104
 

RuralGuy

AWF VIP
Local time
Today, 13:52
Joined
Jul 2, 2005
Messages
13,825
[Loan Amount] = ([Loan Amount]).0104
would modify the table field [Loan Amount]
 

reggiete

Registered User.
Local time
Today, 12:52
Joined
Nov 28, 2015
Messages
56
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
 

RuralGuy

AWF VIP
Local time
Today, 13:52
Joined
Jul 2, 2005
Messages
13,825
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
 

reggiete

Registered User.
Local time
Today, 12:52
Joined
Nov 28, 2015
Messages
56
does it need to be brackets when you are writing code in VBA?
 

RuralGuy

AWF VIP
Local time
Today, 13:52
Joined
Jul 2, 2005
Messages
13,825
Only if there are embedded spaces in the name. I use them to differentiate between Controls on a form and [Fields] in a table.
 

reggiete

Registered User.
Local time
Today, 12:52
Joined
Nov 28, 2015
Messages
56
thanks man that worked. I was just overthinking it :)
 

Users who are viewing this thread

Top Bottom