I'm using Access VBA to run Pass-through query to INSERT into an SQL Server table and received this error: (error no: 3325)
"Pass-through query with ReturnsRecords property set to True did not return any records."
The Access app had been working for sometime now so I don't know why on this particular INSERT it gave me this error.
Below is the fragment of the code that ran the Pass-through query.
============================================================
InsertNewRecord:
strSQL = "INSERT INTO InspectionReport " _
& "(PortCall_ID, IR_Type, XLSFileName, " _
& Left$(gstrInspectionReportField, Len(gstrInspectionReportField) - 2) _
& ", Created_By) " _
& "VALUES (" & glngPortCallID & ", " & "'" & "L" & "'" & ", " _
& "'" & gstrXLFileName & "'" & ", " _
& Left$(gstrInspectionReportValue, Len(gstrInspectionReportValue) - 2) _
& ", " & "'" & gstrCreatedBy & "'" & ")"
Set qdf = CurrentDb.CreateQueryDef("")
qdf.Connect = gstrServerConnect
qdf.SQL = "SET QUOTED_IDENTIFIER OFF " & strSQL
qdf.ReturnsRecords = True
Set rs = qdf.OpenRecordset()
============================================================
It jumped to the error routine right at the last line.
I checked the table after it ran and gave me the error and it seems the record had been inserted, so now I don't know what the problem is.
Does anyone know any possible cause of this? Any help would be greatly appreciated.
Thanks,
Wubb
"Pass-through query with ReturnsRecords property set to True did not return any records."
The Access app had been working for sometime now so I don't know why on this particular INSERT it gave me this error.
Below is the fragment of the code that ran the Pass-through query.
============================================================
InsertNewRecord:
strSQL = "INSERT INTO InspectionReport " _
& "(PortCall_ID, IR_Type, XLSFileName, " _
& Left$(gstrInspectionReportField, Len(gstrInspectionReportField) - 2) _
& ", Created_By) " _
& "VALUES (" & glngPortCallID & ", " & "'" & "L" & "'" & ", " _
& "'" & gstrXLFileName & "'" & ", " _
& Left$(gstrInspectionReportValue, Len(gstrInspectionReportValue) - 2) _
& ", " & "'" & gstrCreatedBy & "'" & ")"
Set qdf = CurrentDb.CreateQueryDef("")
qdf.Connect = gstrServerConnect
qdf.SQL = "SET QUOTED_IDENTIFIER OFF " & strSQL
qdf.ReturnsRecords = True
Set rs = qdf.OpenRecordset()
============================================================
It jumped to the error routine right at the last line.
I checked the table after it ran and gave me the error and it seems the record had been inserted, so now I don't know what the problem is.
Does anyone know any possible cause of this? Any help would be greatly appreciated.
Thanks,
Wubb