473,397 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

VBA Syntax to execute a pass-through?

What is the syntax to use in a VBA script to execute a pass-through? Thanx
Nov 13 '05 #1
4 11500
"Robert" <ro***********@boeing.com> wrote in message
news:I4********@news.boeing.com...
What is the syntax to use in a VBA script to execute a pass-through? Thanx


By "execute" do you mean that the pass-through contains an "action" statement
that will insert, update, or delete records? Or do you want to use a PT that
returns records?

Is this a saved PT query visible in the db window or do you want to construct it
in the vba code?

If it was a saved PT query that ran an "action" statement then you would execute
it the same as an Access action query.

CurrentDB.Execute "NameOfPassThrough", dbFailOnError
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2
Thanx, in fact the pass thru does a 'delete'. I replaced an argument in a
'DoCmd.openQuery' with a PT and when I ran the VBA returned a 'database in
use' message. The existing line of code is

DoCmd.OpenQuery "active_database_delete_action_budget_PT", acNormal, acEdit

the pass thru looks like

DELETE
FROM Active_Database
WHERE ((Active_Database.[Plan Code]='SSTEST') AND ((Active_Database.[User
Code])='BSS') AND ((Active_Database.Budget)='G4028') AND
((Active_Database.[SOW #])=' '));

Is this correct syntax?


"Rick Brandt" <ri*********@hotmail.com> wrote in message
news:2r*************@uni-berlin.de...
"Robert" <ro***********@boeing.com> wrote in message
news:I4********@news.boeing.com...
What is the syntax to use in a VBA script to execute a pass-through?
Thanx
By "execute" do you mean that the pass-through contains an "action" statement that will insert, update, or delete records? Or do you want to use a PT that returns records?

Is this a saved PT query visible in the db window or do you want to construct it in the vba code?

If it was a saved PT query that ran an "action" statement then you would execute it the same as an Access action query.

CurrentDB.Execute "NameOfPassThrough", dbFailOnError
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Nov 13 '05 #3
"Robert" <ro***********@boeing.com> wrote in message
news:I4********@news.boeing.com...
Thanx, in fact the pass thru does a 'delete'. I replaced an argument in a 'DoCmd.openQuery' with a PT and when I ran the VBA returned a 'database in use' message. The existing line of code is

DoCmd.OpenQuery "active_database_delete_action_budget_PT", acNormal, acEdit
the pass thru looks like

DELETE
FROM Active_Database
WHERE ((Active_Database.[Plan Code]='SSTEST') AND ((Active_Database.[User
Code])='BSS') AND ((Active_Database.Budget)='G4028') AND
((Active_Database.[SOW #])=' '));

Is this correct syntax?


Well, that depends totally on the database your talking to (which you
didn't mention).

By definition a Pass-Through query has to be written in the SQL syntax of
the server you are sending the SQL to. If you are using SQL Server, the
syntax will not be the same as in Access. The use of parenthesis and
brackets in your statement makes it look like SQL that was lifted directly
from an Access query and this will most likely not be correct. However
your ODBC driver should tell you about any syntax errors that are
encountered.

What happens when you try to execute the query?
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #4
The query comes from an Access application. The Access query takes a long
time to run due to the chat that occurs between Access and SQL Server. I
converted the query to a PT inorder to make the delete run on the SQL Server
directly. When the PT Query is run from Access the response time is
significantly faster. However, when I run VB application code which calls
the PT query I get a popup,

"Another Analyst is updating DB now. Try again in 15 seconds"

Of course that is a user defined error Message. However, what I am not
certain of is this 'on error' condition due to syntax when I try to execute
the PT. The Access query works fine in the VB code. The PT query works
fine if I run it outside of VB.
"Rick Brandt" <ri*********@hotmail.com> wrote in message
news:2r*************@uni-berlin.de...
"Robert" <ro***********@boeing.com> wrote in message
news:I4********@news.boeing.com...
Thanx, in fact the pass thru does a 'delete'. I replaced an argument in

a
'DoCmd.openQuery' with a PT and when I ran the VBA returned a 'database

in
use' message. The existing line of code is

DoCmd.OpenQuery "active_database_delete_action_budget_PT", acNormal,

acEdit

the pass thru looks like

DELETE
FROM Active_Database
WHERE ((Active_Database.[Plan Code]='SSTEST') AND ((Active_Database.[User Code])='BSS') AND ((Active_Database.Budget)='G4028') AND
((Active_Database.[SOW #])=' '));

Is this correct syntax?


Well, that depends totally on the database your talking to (which you
didn't mention).

By definition a Pass-Through query has to be written in the SQL syntax of
the server you are sending the SQL to. If you are using SQL Server, the
syntax will not be the same as in Access. The use of parenthesis and
brackets in your statement makes it look like SQL that was lifted directly
from an Access query and this will most likely not be correct. However
your ODBC driver should tell you about any syntax errors that are
encountered.

What happens when you try to execute the query?
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
7
by: Steven Bethard | last post by:
So here's the state of the decorator debate as I see it: *** Location GvR pretty strongly wants decorators before the function: ...
7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
5
by: S.Patten | last post by:
Hi, I have a problem with updating a datetime column, When I try to change the Column from VB I get "Incorrect syntax near '942'" returned from '942' is the unique key column value ...
14
by: deko | last post by:
Can the DROP TABLE statement be used with a select or where statement? DROP TABLE SELECT * FROM tblTablesImported WHERE Import_ID Not In (SELECT FROM tblTablesInternal); Or do I have to...
24
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
6
by: FayeC | last post by:
I really need help figuring this out. i have a db with mostly text fields but 2. The user_id field is an autonumber (key) and the user_newsletter is a number (1 and 0) field meaning 1 yes the ...
0
by: Matchkwik | last post by:
Hi all, I am new to programming....but here goes. I am using ASP, SQL Server 2000 database on a shared server environment & IIS 6.0. I have a table called USER_SEARCH, within that table is a...
1
by: gio | last post by:
I have a template class with a function that looks like this: template <class Key, int Value, class Tail> struct Parser<Typelist< MakePair<Key, Value>, Tail >, EmptyType> { static...
16
by: Chuck | last post by:
Please help me correct the statements in sub "BoundData" The following sub is in a module. Everything runs with no error messages, however,data is not reaching the text box. Data is being...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.