Sum

  • Thread starter Thread starter Barcode
  • Start date Start date
B

Barcode

Hello

Please can you make it correct or if there is other way for RESULT2.
I convert query to SQL and copy it to use on Visual Basic.
The code will be so:

RESULT2 =

SELECT Sum(Tillgangar.Anvand) AS SumOfAnvand, Tillgangar.Mobiltelefon
FROM Tillgangar
GROUP BY Tillgangar.Mobiltelefon
HAVING
(((Tillgangar.Mobiltelefon)=[forms]![Kontaktinformation]![Mobiltelefon]));


Thanks a lot
 
You cannot use a query statement directly in code, nor in the Control Source
of a text box.

Try the DSum() function instead, e.g.:
=DSum("Anvand", "Tillgangar", "Mobiltelefon = """ &
[forms]![Kontaktinformation]![Mobiltelefon] & """")

Omit the extra quotes if Mobiltelefon is a Number field (not a Text field.)
 
Back
Top