I have this query, which works great when I run it in Access, then I move this over to my VB code, and it fails:
Code:
Dim cmdTabwareBase As New ADODB.Command
Dim rsTabwareBase As New ADODB.Recordset
Dim oracleTabwareBaseData As String
oracleTabwareBaseData = " SELECT [CMS_COMPLAINT].[COMPLAINT_ID], [CMS_COMPLAINT].[STATUS_CD], [CMS_COMPLAINT].[CREATE_DT], [CMS_COMPLAINT].[CLOSE_DT], [CMS_COMPLAINT].[SAMPLE_IN], [CMS_COMPLAINT].[SAMPLE_RECD_IN], [CMS_COMPLAINT].[SAMPLE_RECD_TEXT], [CMS_COMPLAINT].[SAMPLE_RECD_DT], [CMS_CONTACT].[FIRST_NAME], [CMS_CONTACT].[LAST_NAME], [CMS_CONTACT].[EMAIL_ADDRESS], [CMS_COMPLAINT_OWNER].[OWNER_NAME], [CMS_COMPLAINT_LINE_ITEM].[LOT_NO], [CMS_COMPLAINT_LINE_ITEM].[PRODUCT_ID], [CMS_COMPLAINT_LINE_ITEM].[LINE_ID]" & _
"FROM [CMS_COMPLAINT], [CMS_CONTACT], [CMS_COMPLAINT_OWNER], [CMS_COMPLAINT_LINE_ITEM]" & _
"WHERE [CMS_COMPLAINT].[COMPLAINT_ID] In (SELECT [COMPLAINT_ID] FROM [CMS_COMPLAINT_LINE_ITEM] As TmpID)
AND [CMS_COMPLAINT].[STATUS_CD]<>'Closed' AND
[CMS_COMPLAINT].[CREATE_DT] <= SYSDATE-15 AND
[CMS_COMPLAINT].[CLOSE_DT] IS NULL AND
[CMS_COMPLAINT].[SAMPLE_IN]='N' AND
[CMS_COMPLAINT].[SAMPLE_RECD_IN]='N' AND
[CMS_COMPLAINT_OWNER].[OWNER_NAME]='Kennebunk Plant'
GROUP BY [COMPLAINT_ID] HAVING Count(*)=1 "
The error is ORA-00936 missing expression, which could be almost anything...any ideas why VB does not like the format, what am I missing?
Thanks!!
Kai-What?