Sum a field that refers to a combobox column (1 Viewer)

PeterOC

Registered User.
Local time
Today, 14:46
Joined
Nov 22, 2007
Messages
80
Hello,


I have a field in a form called 'PricePerKg'
Control Source: = [StockCode].[Column](3)

What I'd like to do is get a total of this field in the form footer.

I put in sum([StockCode].[Column](3)) but I just get error.

What's the correct syntax to get this to sum?

Thanks,

Peter
 

khodr

Experts still Learn
Local time
Today, 09:46
Joined
Dec 3, 2012
Messages
112
try =nz(sum([StockCode].[Column](3)),0) am not sure if it works because I don't know how your form is build, but still try it, then it might work.
 

PeterOC

Registered User.
Local time
Today, 14:46
Joined
Nov 22, 2007
Messages
80
Thanks khodr but I'm still getting the errors in the form footer field.
The field to be summed is double data type.
I've put the nz in the detail line and in the total field in the form footer.
I've also tried
Cdbl(nz(Sum([StockCode].[Column](3)),0))
Any other ideas?
 

khodr

Experts still Learn
Local time
Today, 09:46
Joined
Dec 3, 2012
Messages
112
Js for me I do this normally via the query itself but I need to understand the table structure can post an image here about your table structure
 

Sketchin

Registered User.
Local time
Yesterday, 23:46
Joined
Dec 20, 2011
Messages
575
Put a hidden textbox in the detail section with this as a control source:
nz(sum([StockCode].[Column](3)),0)

Then in the footer of the form, reference that textbox by putting this in the control source:
=[Formname].[Form]![yourtextbox]
 

Users who are viewing this thread

Top Bottom