I have the following sql query in a database. Is there a way for me to incorporate the If Else statement in?
I have a form where the user will select their property class from a combo box and enter their amount in a text box. With that the various calculations below. I need to make the If-then-else calculation also.
The form has a calculate button with a requery macro to run it after the user enters in the information.
If I am unable to put in the sql query, how would I go about doing it in VB Code with the underlying info source from the query for calculation and have it show up in an unbound text box?
Sql:
SELECT RMVPropertyClassRates.PropertyClass, RMVPropertyClassRates.Limit, RMVPropertyClassRates.ClassRate1, RMVPropertyClassRates.ClassRate2, (Forms!RMV!txtAmount)*0.00158002 AS Q1, (Forms!RMV!txtAmount)*0.00029901 AS Q2, (Forms!RMV!txtAmount)*0.00023785 AS Q3, (Forms!RMV!txtAmount)*0.00013592 AS Q4, *
FROM RMVPropertyClassRates
WHERE (((RMVPropertyClassRates.PropertyClass)=Forms!RMV!CboPropClass));
Need this incorporated:
If [Amount] > [Limit] Then ([Amount] - [Limit]) * [ClassRate2] +( [Limit] * [ClassRate1]) * 0.23
Else
[Amount] * [Limit1]) * 0.23
End If
Any help would greatly be appreciated!
Thanks.
I have a form where the user will select their property class from a combo box and enter their amount in a text box. With that the various calculations below. I need to make the If-then-else calculation also.
The form has a calculate button with a requery macro to run it after the user enters in the information.
If I am unable to put in the sql query, how would I go about doing it in VB Code with the underlying info source from the query for calculation and have it show up in an unbound text box?
Sql:
SELECT RMVPropertyClassRates.PropertyClass, RMVPropertyClassRates.Limit, RMVPropertyClassRates.ClassRate1, RMVPropertyClassRates.ClassRate2, (Forms!RMV!txtAmount)*0.00158002 AS Q1, (Forms!RMV!txtAmount)*0.00029901 AS Q2, (Forms!RMV!txtAmount)*0.00023785 AS Q3, (Forms!RMV!txtAmount)*0.00013592 AS Q4, *
FROM RMVPropertyClassRates
WHERE (((RMVPropertyClassRates.PropertyClass)=Forms!RMV!CboPropClass));
Need this incorporated:
If [Amount] > [Limit] Then ([Amount] - [Limit]) * [ClassRate2] +( [Limit] * [ClassRate1]) * 0.23
Else
[Amount] * [Limit1]) * 0.23
End If
Any help would greatly be appreciated!
Thanks.