Wow yes! Thank you so much - works perfectly. Question before I close this - Why use "Me!"? Also why when you give 0 it doesn't bring the CostPriceExGST to 0 as a result if false? Does the 0 just represent adding a null 0? (I think I've answered the second question)...
I should have used the Me qualifier on all the control/field references.
PriceTotal = CostPriceExGST + IIf(Me!GSTRegistered = True, Me.CostPriceExGST * Me.GSTPercent, 0)
Me is shorthand alias for name of form the code is behind. The dot will invoke intellisense popup tips.
Adds 0 if GSTRegistered is not True.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Is it important to have "Me!" ....?I should have used the Me qualifier on all the control/field references.
PriceTotal = CostPriceExGST + IIf(Me!GSTRegistered = True, Me.CostPriceExGST * Me.GSTPercent, 0)
Me is shorthand alias for name of form the code is behind. The dot will invoke intellisense popup tips.
Adds 0 if GSTRegistered is not True.
me. I assume is current table and Me! is a different table
Both qualifiers are referencing the form the code is behind. I use ! (bang) when referencing a field in the form's RecordSource but not bound to a data control. Use . (dot) to invoke intellisense.
I always give data controls names different from the fields they are bound to, like tbxCostPriceExGST.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Ok, Many thanks!