Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is something wrong with this code?

Status
Not open for further replies.
Sep 25, 2002
159
US
Hi,

I have this piece of code in my VBA Module and when I run it, I keep getting an Unknown error on the DoCmd command. I can't see anything wrong with the syntax, so either, I've been looking at the code too long or there is something about the dAvg function I don't understand:

TokyoWeeklyClosedByCommit is an integer field with values.

strSQL = "UPDATE ClosedByCommit SET TokyoRunningAverage = " & _
"DAvg(""[TokyoWeeklyClosedByCommit]"",""TokyoInternalActions"",""[ID] <= 3"")" & _
"WHERE ID = 1;"
DoCmd.RunSQL strSQL

Thank you
 
You need a space before your where clause. Try:
Code:
strSQL = "UPDATE ClosedByCommit SET TokyoRunningAverage = " & _
"DAvg(""[TokyoWeeklyClosedByCommit]"",""TokyoInternalActions"",""[ID] <= 3"")" & _
" WHERE ID = 1;"
 
I wish it would have been that easy :) but i'm still getting the same error.
 
Hi!

Try this:

strSQL = "UPDATE ClosedByCommit SET TokyoRunningAverage = " & _
"DAvg('[TokyoWeeklyClosedByCommit]','TokyoInternalActions','[ID] <= 3') " & _
"WHERE ID = 1;"


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
If you put your sql in a query instead of VBA, do you get the same error?
 
How about:
strSQL = "UPDATE ClosedByCommit SET TokyoRunningAverage = " & _
DAvg("[TokyoWeeklyClosedByCommit]", "TokyoInternalActions", "[ID] <= 3") & _
" WHERE ID = 1;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top