adding conditionial sum for a field

stumbler

Registered User.
Local time
Today, 09:33
Joined
Jul 30, 2008
Messages
13
Hello,
i need to total up all sales for 1 supplier and compare to the total.
I was thinking on adding a condition in a calculated field. The condition refers to a textbox on the report header.
Code:
=Sum(IIf([supplier]=[txtSupplier];totalqty;0))
but each time i get a prompt to supply the value: it's not reading from the header.
for testing purposes, i supply the value for txtsupplier control in the onload event
Code:
Private Sub Report_Load()
Me.txtSupplier = "LANNEA"
End Sub
Any suggestions?

Thx
 
Store the value before the report is opened. On Load is too late.
 
Code:
Private Sub Report_Open(Cancel As Integer)

Reports("rptSalesPerMonth").txtSupplier = "LANNEA"
Me.txtSupplier = "LANNEA"

End Sub
gives me the error: cannot assign value to thisd control
 

Users who are viewing this thread

Back
Top Bottom