I have 4 IIF Statement that calculate State Taxes for marital status: Married, Single and greater than > income, or less than <income for each marital status.
All 4 Statements end in -([Exemption credit]) or -([Exemption credit])). They work individually they way they are supposed to.
When I combine just 2 of them to start, (working my way out) I get “The expression you entered contains invalid syntax, or you need to enclose your text data in quotes.” It highlights the comma that separates the expressions. I could be wrong but, I don't think it likes my expression ending in -([field]). I can’t remove the () around [field] because it changes the results completely.
I’ve attached the DB to show the results I have in QryStateTax. I need to combine MarSM, MarLg, SingSM and SingLG into one column and carry those results to the qryCDpayrolltaxesWI field currently name Expr1. qryCDpayrolltaxesWI will calculate the exact State Tax to export the results to the QryCDpaytollrecomm which combines all the Medicare, Social Security, Federal tax and State tax that will show the recommended taxes for payroll.
I’m sure this could all be done in a vba easily, which I plan to learn which can be Ver2 of the DB, but right now I need to get this to testers to make sure it works for them.
All 4 Statements end in -([Exemption credit]) or -([Exemption credit])). They work individually they way they are supposed to.
When I combine just 2 of them to start, (working my way out) I get “The expression you entered contains invalid syntax, or you need to enclose your text data in quotes.” It highlights the comma that separates the expressions. I could be wrong but, I don't think it likes my expression ending in -([field]). I can’t remove the () around [field] because it changes the results completely.
I’ve attached the DB to show the results I have in QryStateTax. I need to combine MarSM, MarLg, SingSM and SingLG into one column and carry those results to the qryCDpayrolltaxesWI field currently name Expr1. qryCDpayrolltaxesWI will calculate the exact State Tax to export the results to the QryCDpaytollrecomm which combines all the Medicare, Social Security, Federal tax and State tax that will show the recommended taxes for payroll.
Code:
MarSM2: IIf([tblEmployees].[Marital Status]=1 And [Basic Salary]<25727,[tblEmployees].[Basic Salary]-[tblpayrolltaxes].[Amount from Column A]-([Exemption credit]))
Changes the negatives from above to 0
MarSM: IIf([MarSM2]<0,0,[MarSM2])
MarLG: IIf([tblEmployees].[Marital Status]=1 And [Basic Salary]>25727,[tblEmployees].[Basic Salary]-([tblpayrolltaxes].[Amount from Column A]-([tblEmployees].[Basic Salary]-[tblpayrolltaxes].[Lower])*0.2))-([Exemption credit])
SingSM1: IIf([tblEmployees].[Marital Status]=2 And [Basic Salary]<17780,[tblEmployees].[Basic Salary]-([tblpayrolltaxes].[Amount from Column A]-[tblpayrolltaxes].[Lower])-([Exemption credit]))
Changes the negative from above to 0
SingSM: IIf([SingSM1]<0,0,[SingSM1])
SingLG: IIf([tblEmployees].[Marital Status]=2 And [Basic Salary]>17780,[tblEmployees].[Basic Salary]-([tblpayrolltaxes].[Amount from Column A]-([tblEmployees].[Basic Salary]-[tblpayrolltaxes].[Lower])*0.12))-([Exemption credit])