update query with subselect for percent total

whitesmoke

Registered User.
Local time
Yesterday, 22:03
Joined
Jun 23, 2006
Messages
29
Does anyone know a way to make this code work. I'm trying to get the percent total (curyear/sum(curyear))*100
the sum is messings things up when reworking it with a query so i created the code below but i get an error 3073, not being able to update .
thank you in advance to anyone that can help.

vCurYear = DSum("CurrentYTD", "tsnapshot")

DoCmd.RunSQL ("UPDATE tSnapshot a SET a.TOTAL =
(SELECT ((b.CurrentYTD / " & vCurYear & ") * 100 ) FROM tSnapshot b WHERE a.facid = b.facid and a.custid=b.custid)")
 

Users who are viewing this thread

Back
Top Bottom