PDA

View Full Version : My VBA statmant is not working.



BarbWest
02-03-2017, 12:01 PM
If QtyIn is > than 0 I want that number added to Quantity on Hand, and put that number in Bal. and if QtyOut is > 0 I want that number Subtracted from Quantity on Hand, and put that number in Bal. I've tried so many things but this is the closest I've gotten to it.

In the Query I've written

Bal: IIf([InventoryTransactions_tbl]![QtyIn]>0,Sum([InventoryTransactions_tbl]![QtyIn]+[InventoryTransactions_tbl]![QtyonHandl]=[InventoryTransactions_tbl]![Bal])
IIf([InventoryTransactions_tbl]![QtyOut]>0,Sum([InventoryTransactions_tbl]![QtyOut]-[InventoryTransactions_tbl]![QtyonHand]=[InventoryTransactions_tbl]![Bal])
I keep getting an error.

jonh
02-03-2017, 04:26 PM
You can't use = in a function parameter.


[Bal]=[QtyonHand]+[QtyIn]-[QtyOut]

BarbWest
02-06-2017, 06:34 AM
You can't use = in a function parameter.


[Bal]=[QtyonHand]+[QtyIn]-[QtyOut]

I tried that and I get an error reading "Circular reference caused by alias 'Bal' in Query definition's Select list.