I also get an error on the group by expression. - expected: line number or label or end of statement
the end result is to display the query result on a message box, Hwr I would like to ignore or the message box to say no records if the query return no lines/data.
can somebody help me point in the right direction
Currrent module:
Dim ctl1 As Control
Dim cmd1 As Command
Dim rst1 As Recordset
Dim str1 As String
Set cmd1 = New ADODB.Command
With cmd1
.ActiveConnection = CurrentProject.Connection
.CommandText = "SELECT QryIncorrectprices.Dispref, " & _
"QryIncorrectprices.Sellprice, " & _
"QryIncorrectprices.cat " & _
"FROM QryIncorrectprices " & _
"WHERE QryIncorrectprices.cat = 'false & ;"
"GROUP BY QryIncorrectprices.Dispref, QryIncorrectprices.Sellprice, QryIncorrectprices.Sellprice;"
.CommandType = adCmdText
.Execute
End With
Set cmd1 = QryIncorrectprices
Set rst1 = New ADODB.Recordset
rst1.Open [QryIncorrectprices], , adOpenKeyset, adLockOptimistic
Do Until rst1.EOF
str1 = str1 & rst1.Fields(0) & ", " & rst1.Fields(1) & ", " & rst1.Fields(2)
str1 = str1 & vbCrLf
rst1.MoveNext
Loop
MsgBox str1, vbInformation, "SQS"