0
votes

I think this should be straight forward. I have an insert query. I am modifying a query field that is calling a public function that does a dlookup and it calculates any discounts. I only want to call this function if an id is below a certain number. If above that number I want to populate it with a field from my form. This is the original call:

GetTuition(Forms![createinvoice]!AfterschoolFrame,Forms!
[createinvoice]!BillCycleID,Forms![createinvoice]![1DayAfterschool15],Forms!
[createinvoice]![TuitionToPay]) AS Fee

But when I add an IIF, it crashes

IIf (Forms![createinvoice]!ScholarID <4
(GetTuition(Forms![createinvoice]!AfterschoolFrame,Forms!
[createinvoice]!BillingCycleID,
Forms![createinvoice]![1DayAfterschool15],
Forms![createinvoice]![TuitionToPay]) , Forms![createinvoice]!TuitionCost )) 
AS Fee

Any ideas would be greatly appreciated.

1

1 Answers

1
votes

You've made an error with your parentheses (you should remove the last one, and the 2nd one), and are missing a , after the if condition.

This fixes it:

IIf (Forms![createinvoice]!ScholarID <4, 
GetTuition(Forms![createinvoice]!AfterschoolFrame,Forms!
[createinvoice]!BillingCycleID,
Forms![createinvoice]![1DayAfterschool15],
Forms![createinvoice]![TuitionToPay]) , Forms![createinvoice]!TuitionCost) 
AS Fee