Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Pass-through query Error

Pass-through query Error

Pass-through query Error

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.

  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.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.


RE: Pass-through query Error

Well a INSERT record statement never returns any record, so qdf.ReturnsRecords should be set to FALSE as far as I know.

For same reason you should not be using a recordset object to execute that SQL.


Frederico Fonseca
SysSoft Integrated Ltd

RE: Pass-through query Error

Thanks for the tip Frederico.

That's what I thought about the INSERT too.
I don't think it should return any record and as far as I know there isn't any trigger that handles INSERT on this table.
However, this has been done before me and it had been working fine for a while now, and that's also one of the thing that puzzles me, as to why it worked when it doesn't seem to be returning any records. So I'm reluctant to change it since it might work for this particular INSERT record but might have errors in the future.

"For same reason you should not be using a recordset object to execute that SQL."
Could you please elaborate on this?


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close