I need help building an expression in MS access. I know the basics but I’ve not done a complicated expression before.
The database is something that gets data like labor and materials from jobs and marks them up to what we charge the customer. I have figured out the labor side, but the material side is more complex. The current formula is this:
Material Cost: IIf([MATERIAL_TYPE]="S" Or [MATERIAL_TYPE]="M",[MATERIAL_COST]*1.42,[MATERIAL_COST])
What I need to do is add a new material type into the equation ([MATERIAL_TYPE]="T")
but only when [MATERIAL_TYPE]="T"
is from accounts 5, 6, or 7. How do I do this?
I’ve tried this expression but the syntax is not correct.
Material Cost: IIf([MATERIAL_TYPE]="S" Or [MATERIAL_TYPE]="M" Or ([MATERIAL_TYPE]="T" where [ACCT = "5" "6" "7"]),[MATERIAL_COST]*1.42,[MATERIAL_COST])
Sample data:
Product 1 (Material Type S, Account 4)
Product 2 (Material Type S, Account 5)
Product 3 (Material Type M, Account 2)
Product 4 (Material Type M, Account 6)
Product 5 (Material Type T, Account 6)
Product 6 (Material Type T, Account 9)
Product 7 (Material Type T, Account 1)
Using the sample data I’d want the first 5 products selected, but not the last 2, if that makes sense.
Grant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.