?
Solved

Access, SQL Server

Posted on 2010-08-26
11
Medium Priority
?
544 Views
Last Modified: 2012-05-10
I'm trying to execute a store procedure (just simple like 'TRUNCATE TABLE tablename') through a pass through in Access, but it give me a run-time error '3325' saying 'Pass-through query with ReturnsRecords property set to True did not return any records', please let me know why
0
Comment
Question by:qnryat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 44

Accepted Solution

by:
Leigh Purvis earned 2000 total points
ID: 33534793
Because an action such as 'TRUNCATE TABLE' doesn't return any records.
You should set your Returns Records property as False in the query properties sheet (assuming it's a persisted querydef and not just created on the fly).
0
 
LVL 2

Expert Comment

by:bgrandjean
ID: 33534797
Open the query in design mode and open the properties window.  Set the Returns Records property to No.  Access generally expects a query to return rows and this setting property will tell it not to expect rows.
0
 

Author Comment

by:qnryat
ID: 33534862
I set the Returns REcords to no, now I get the error with server log in, here's how I call the sp with a
docmd.openquery passthroughqueryname
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 44

Assisted Solution

by:Leigh Purvis
Leigh Purvis earned 2000 total points
ID: 33534893
You still get the error if you open the query by double clicking it in the DB window / Nav Pain?
A problem with the server login is just that.
You need to make sure you have valid credentials assigned.
What is your query's Connect property (obfuscating any sensitive details as required of course - i.e. don't give us all your password ;-).
0
 

Author Comment

by:qnryat
ID: 33535052
yes I still get the error by double clicking on it in the db window. No password require, I was able to open the Sql table in the db window
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 33535446
And does the passthrough have the same Connect property as that linked table?
0
 

Author Comment

by:qnryat
ID: 33535575
How do I set the connect property in the query so that it will point to the right datasource without having it popup to select the datasource?
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 33535643
What is your Connect property currently??
0
 

Author Comment

by:qnryat
ID: 33535772
It was just "ODBC;" then I added PSF_GEN so "ODBC;PSF_GEN" which is the name of the server, and it's working now. But if I don't want to create a passthrough query, but instead having a docmd, what would it be?
DoCmd.RunSQL ("Truncate Table....) or how do I specify the connnection in the docmd statement?
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 33535828
You're sending a command to the server.
You can't trivially just execute that locally - that's exactly what passthroughs are for.
If you enter a valid Connect property you won't be prompted for anything.

If you want to execute commands in a more ad-hoc manner then you can use a variation of the theme in this recent thread - but it'll take a bit of VBA understanding.
0
 

Author Comment

by:qnryat
ID: 33535939
I got it. Thanks.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question