Hello, I'm fairly new to the concept of running action pass through
queries (insert, update, etc.) from Access 2000. I have a SQL Server
2000 database and I'm using a Access 2K database as my front end.
I'm using a blank pass through query which gets the Transact-SQL part
inserted from a button in my form. After inserting the Transact-SQL
code into the pass through query, I 'open the recordset' to make the
query run.
However, everytime this is successful I get a 3325 runtime error:
"Pass-through query with ReturnsRecords property set to True did not
return any records". I've tried to set the Return Records query
property to 'No' but it does not insert any records if I do. I have to
catch that 3325 error in the error handler, but I don't want that error
to show up at all.
This also happens with my Update Pass Through Queries. What I want is
to just insert the SQL code in the pass through query, run it so it
inserts or updates and that's it. I don't want to return a recordset,
or I don't want to return errors. I know I could do this with a store
procedure, but I'm hoping this could work too.
This is what I do from my button:
---------------------------------------------------
On Error GoTo ExitHere
' Using a Pass Through query to insert the new records
Dim loDB As DAO.Database
Dim loQdf As DAO.QueryDef
Dim rs As DAO.Recordset
' set the variable values
Set loDB = CurrentDb
Set loQdf = loDB.QueryDefs("qryInsertRecords")
loQdf.SQL = "INSERT INTO Orders (CheckNumber, FirstName, LastName,
Amount, AddedBy ) SELECT Finance.CheckNumber, Finance.FirstName,
Finance.LastName, Finance.Amount, Finance.AddedBy FROM Finance"
' opening the new recordset
Set rs = loQdf.OpenRecordset()
'clear variables
Set loQdf = Nothing
Set loDB = Nothing
' exiting form
ExitHere:
Exit Sub
'error handling
HandleErr:
If Err.Number = 3325 Then GoTo ExitHere ' help! I don't want this
error to show!
MsgBox Err.Number & ": " & Err.Description, , "Insert Record"
Resume ExitHere
Resume
-------------------------------------------------------
Any help would be apprecitated.
Thanks! 3 12557 IL***@NETZERO.NET wrote: Hello, I'm fairly new to the concept of running action pass through queries (insert, update, etc.) from Access 2000. I have a SQL Server 2000 database and I'm using a Access 2K database as my front end.
I'm using a blank pass through query which gets the Transact-SQL part inserted from a button in my form. After inserting the Transact-SQL code into the pass through query, I 'open the recordset' to make the query run.
However, everytime this is successful I get a 3325 runtime error: "Pass-through query with ReturnsRecords property set to True did not return any records". I've tried to set the Return Records query property to 'No' but it does not insert any records if I do. I have to catch that 3325 error in the error handler, but I don't want that error to show up at all.
This also happens with my Update Pass Through Queries. What I want is to just insert the SQL code in the pass through query, run it so it inserts or updates and that's it. I don't want to return a recordset, or I don't want to return errors. I know I could do this with a store procedure, but I'm hoping this could work too.
This is what I do from my button: --------------------------------------------------- On Error GoTo ExitHere
' Using a Pass Through query to insert the new records Dim loDB As DAO.Database Dim loQdf As DAO.QueryDef
Dim rs As DAO.Recordset
' set the variable values Set loDB = CurrentDb Set loQdf = loDB.QueryDefs("qryInsertRecords")
loQdf.SQL = "INSERT INTO Orders (CheckNumber, FirstName, LastName, Amount, AddedBy ) SELECT Finance.CheckNumber, Finance.FirstName, Finance.LastName, Finance.Amount, Finance.AddedBy FROM Finance"
' opening the new recordset Set rs = loQdf.OpenRecordset()
You don't "open" action queries. You "execute" them.
After modifying the SQL use...
loDB.Execute "qryInsertRecords", dbFailOnError
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Yes, I just found out that too.
Thanks Rick.
Rick Brandt wrote: IL***@NETZERO.NET wrote: Hello, I'm fairly new to the concept of running action pass through queries (insert, update, etc.) from Access 2000. I have a SQL Server 2000 database and I'm using a Access 2K database as my front end.
I'm using a blank pass through query which gets the Transact-SQL part inserted from a button in my form. After inserting the Transact-SQL code into the pass through query, I 'open the recordset' to make the query run.
However, everytime this is successful I get a 3325 runtime error: "Pass-through query with ReturnsRecords property set to True did not return any records". I've tried to set the Return Records query property to 'No' but it does not insert any records if I do. I have to catch that 3325 error in the error handler, but I don't want that error to show up at all.
This also happens with my Update Pass Through Queries. What I want is to just insert the SQL code in the pass through query, run it so it inserts or updates and that's it. I don't want to return a recordset, or I don't want to return errors. I know I could do this with a store procedure, but I'm hoping this could work too.
This is what I do from my button: --------------------------------------------------- On Error GoTo ExitHere
' Using a Pass Through query to insert the new records Dim loDB As DAO.Database Dim loQdf As DAO.QueryDef
Dim rs As DAO.Recordset
' set the variable values Set loDB = CurrentDb Set loQdf = loDB.QueryDefs("qryInsertRecords")
loQdf.SQL = "INSERT INTO Orders (CheckNumber, FirstName, LastName, Amount, AddedBy ) SELECT Finance.CheckNumber, Finance.FirstName, Finance.LastName, Finance.Amount, Finance.AddedBy FROM Finance"
' opening the new recordset Set rs = loQdf.OpenRecordset()
You don't "open" action queries. You "execute" them.
After modifying the SQL use...
loDB.Execute "qryInsertRecords", dbFailOnError
-- I don't check the Email account attached to this message. Send instead to... RBrandt at Hunter dot com IL***@NETZERO.NET wrote: Yes, I just found out that too. Thanks Rick.
Rick Brandt wrote: You don't "open" action queries. You "execute" them.
After modifying the SQL use...
loDB.Execute "qryInsertRecords", dbFailOnError
Apologies for coming onto this so late (I've been away), but another
thing you may wish to add, just _before_ the execute statement Rick
showed you, is:
loDB.ReturnsRecords = False
A common complaint of folks new to action PTQs is that Access throws an
irritating advisory message: "Pass-through query with ReturnsRecords
property set to True did not return any records". Setting the
ReturnsRecords property to false will tell Access it's OK that the
statement doesn't return records and you won't get the advisory.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Adam Louis |
last post by:
I would like help resolving this problem. I'm a novice who's been
hired to query a hospital database and extract useful information,
available to me only in a dynamically generated, downloadable...
|
by: Access Newbie |
last post by:
I'm using Access 2000 and I'm trying to create a pass-through query to
append all the data from a local table to a remote table.
I'm using the SQL query editor in MS Access to create the query (I...
|
by: JM |
last post by:
Hello,
Using Access 2000 queries, you can reference(pass) form values directly
using syntax like Forms!frmPaint!txtColor. I want to do a pass
through query to SQL Server 2000, but I don't know...
|
by: ILCSP |
last post by:
Hello, I'm in the process of changing our 'normal' Access 2000 update
queries to Update Pass Through Queries. We have a SQL server 2000
database and we're using an Access 2000 database as our...
|
by: ILCSP |
last post by:
Hello again, I'm still in the process of changing ms access queries to
Pass through queries. We're using a SQL Server 2000 database with an
Access 2000 DB as our front end.
I trying to convert...
|
by: riki71 |
last post by:
hallo developerfriends,
I have a urgent problem with transfering Data from a DB2-Server to Access97.
Tranfer runs by following steps:
1. creating pass-through-query
2. runing action-query based...
|
by: gumby |
last post by:
I would like to call this stored procedure, but I am unable to pass
parameters to the @Start and @End.
Is thier a way to pass parameters to a pass through query from MS
Access?
SELECT ...
|
by: marshmallowww |
last post by:
I have an Access 2000 mde application which uses ADO and pass through
queries to communicate with SQL Server 7, 2000 or 2005.
Some of my customers, especially those with SQL Server 2005, have had...
|
by: magickarle |
last post by:
Hi, I got a pass-through query (that takes about 15 mins to process)
I would like to integrate variables to it.
IE: something simple:
Select EmplID from empl_Lst
where empl_lst.timestamp between...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |