I've used SQL statements that are much longer than that,but I don't write
them as a single row.
See whether the following works:
strSQL = "SELECT qryCETESBWellStats.Year FROM qryCETESBWellStats " & _
"GROUP BY qryCETESBWellStats.Year, qryCETESBWellStats.Analyte, " & _
"qryCETESBWellStats.Aquifier, qryCETESBWellStats.ZoneClass HAVING " & _
"(((qryCETESBWellStats.Analyte)= '" & Me.cbAnalyte & "') AND " & _
"((qryCETESBWellStats.Aquifier)= '" & Me.cmbAquifier & "') AND " & _
"((qryCETESBWellStats.ZoneClass)='" & Me.cmbZone & "'))"
or
strSQL = "SELECT qryCETESBWellStats.Year FROM qryCETESBWellStats "
strSQL = strSQL & "GROUP BY qryCETESBWellStats.Year,
qryCETESBWellStats.Analyte, "
strSQL = strSQL & "qryCETESBWellStats.Aquifier, qryCETESBWellStats.ZoneClass
HAVING "
strSQL = strSQL & "(((qryCETESBWellStats.Analyte)= '" & Me.cbAnalyte & "')
AND "
strSQL = strSQL & "((qryCETESBWellStats.Aquifier)= '" & Me.cmbAquifier & "')
AND "
strSQL = strSQL & "((qryCETESBWellStats.ZoneClass)='" & Me.cmbZone & "'))"
BTW, Year is a reserved word, so really isn't a good choice for a field
name. If you absolutely can't change it, you may want to put square brackets
around it:
strSQL = "SELECT qryCETESBWellStats.[Year] FROM qryCETESBWellStats ....