Hello all, working in VB6 I want to pull all records from Access table named Answers that in a field named Color have "White". Within that record there are 10 fields of various numbers that I want to sum and average. In short I want to pull all records with White as the color and average the sums of each of the additional fields in the pulled records.

Using the code below I'm getting a "Syntax Error Missing an Operator" error. What am I missing? Sorry for the befuddled explanation and thanks for the help.

strColor = "White"
strSQL = "Select Answers.Color,Sum(Answer2)/7 as TotAns2 FROM Answers GROUP BY Answers.Color WHERE Answers.Color = '" & strColor & "'"

Recommended Answers

All 2 Replies

strSQL = "Select Answers.Color,Sum(Answer2)/7 as TotAns2 FROM Answers
  WHERE Answers.Color = '" & strColor & "'  GROUP BY Answers.Color"

Thanks for the response, works great.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.