473,394 Members | 1,765 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,394 software developers and data experts.

calling stored procedure on sql server DAO

I'm calling a stored procedure on a sql server from an access
application. I just need the stored procedure to run I do not need any
data returned from the stored procedure to my Access application but I
do pass parameters from my Access application. What I have works fine
and is attached below. But I have one question. Why do I need this
line of code to execute the stored procedure.
Set rst = qdf.OpenRecordset(dbOpenSnapshot)

Here is the rest of my code:

Sub StoredProcedure()
Dim dbs As DAO.DataBase
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strConnectString As String
Dim Company As Long
Dim JobNumber As String
Dim Shift As Long
Dim DayWorked As String
Company = GetCompany()
JobNumber = "'" & GetJob() & "'"
Shift = GetShift()
DayWorked = "'" & GetDate() & "'"

Set dbs = CurrentDb

strConnectString = "ODBC" & _
";Database=Viewpoint" & _
";UID=ODBC" & _
";PWD=odbc" & _
";DSN=Viewpoint"
Set qdf = dbs.CreateQueryDef("")
qdf.Connect = strConnectString
qdf.ReturnsRecords = True

qdf.SQL = "dbo.uspTRFile " & Company & "," & JobNumber & "," & Shift &
"," & DayWorked & ""
Set rst = qdf.OpenRecordset(dbOpenSnapshot)

rst.Close
Set rst = Nothing
Set qdf = Nothing
End Sub

Jan 17 '07 #1
4 17354
On 17 Jan 2007 12:28:25 -0800, "eighthman11" <rd******@nooter.com>
wrote:

I think because calling stored procedures using DAO only barely works,
and this essentially is a workaround. More elegant would be if DAO had
an Execute method, like ADO does.

-Tom.

>I'm calling a stored procedure on a sql server from an access
application. I just need the stored procedure to run I do not need any
data returned from the stored procedure to my Access application but I
do pass parameters from my Access application. What I have works fine
and is attached below. But I have one question. Why do I need this
line of code to execute the stored procedure.
Set rst = qdf.OpenRecordset(dbOpenSnapshot)

Here is the rest of my code:

Sub StoredProcedure()
Dim dbs As DAO.DataBase
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strConnectString As String
Dim Company As Long
Dim JobNumber As String
Dim Shift As Long
Dim DayWorked As String
Company = GetCompany()
JobNumber = "'" & GetJob() & "'"
Shift = GetShift()
DayWorked = "'" & GetDate() & "'"

Set dbs = CurrentDb

strConnectString = "ODBC" & _
";Database=Viewpoint" & _
";UID=ODBC" & _
";PWD=odbc" & _
";DSN=Viewpoint"
Set qdf = dbs.CreateQueryDef("")
qdf.Connect = strConnectString
qdf.ReturnsRecords = True

qdf.SQL = "dbo.uspTRFile " & Company & "," & JobNumber & "," & Shift &
"," & DayWorked & ""
Set rst = qdf.OpenRecordset(dbOpenSnapshot)

rst.Close
Set rst = Nothing
Set qdf = Nothing
End Sub
Jan 18 '07 #2
I have no experience with sql server, but there is an execute in the DAO
querydef object. Isn't this the same as ADO?

"Tom van Stiphout" <no*************@cox.netwrote in message
news:1k********************************@4ax.com...
On 17 Jan 2007 12:28:25 -0800, "eighthman11" <rd******@nooter.com>
wrote:

I think because calling stored procedures using DAO only barely works,
and this essentially is a workaround. More elegant would be if DAO had
an Execute method, like ADO does.

-Tom.

I'm calling a stored procedure on a sql server from an access
application. I just need the stored procedure to run I do not need any
data returned from the stored procedure to my Access application but I
do pass parameters from my Access application. What I have works fine
and is attached below. But I have one question. Why do I need this
line of code to execute the stored procedure.
Set rst = qdf.OpenRecordset(dbOpenSnapshot)

Here is the rest of my code:

Sub StoredProcedure()
Dim dbs As DAO.DataBase
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strConnectString As String
Dim Company As Long
Dim JobNumber As String
Dim Shift As Long
Dim DayWorked As String
Company = GetCompany()
JobNumber = "'" & GetJob() & "'"
Shift = GetShift()
DayWorked = "'" & GetDate() & "'"

Set dbs = CurrentDb

strConnectString = "ODBC" & _
";Database=Viewpoint" & _
";UID=ODBC" & _
";PWD=odbc" & _
";DSN=Viewpoint"
Set qdf = dbs.CreateQueryDef("")
qdf.Connect = strConnectString
qdf.ReturnsRecords = True

qdf.SQL = "dbo.uspTRFile " & Company & "," & JobNumber & "," & Shift &
"," & DayWorked & ""
Set rst = qdf.OpenRecordset(dbOpenSnapshot)

rst.Close
Set rst = Nothing
Set qdf = Nothing
End Sub

Jan 18 '07 #3
eighthman11 wrote:
I'm calling a stored procedure on a sql server from an access
application. I just need the stored procedure to run I do not need
any data returned from the stored procedure to my Access application
but I do pass parameters from my Access application. What I have
works fine and is attached below. But I have one question. Why do
I need this line of code to execute the stored procedure.
Set rst = qdf.OpenRecordset(dbOpenSnapshot)
The reason you have to do that is because you have specified...
qdf.ReturnsRecords = True

If you set that to No then you should be able to use Execute instead of
Open.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jan 18 '07 #4
Thanks for the response

Rick Brandt wrote:
eighthman11 wrote:
I'm calling a stored procedure on a sql server from an access
application. I just need the stored procedure to run I do not need
any data returned from the stored procedure to my Access application
but I do pass parameters from my Access application. What I have
works fine and is attached below. But I have one question. Why do
I need this line of code to execute the stored procedure.
Set rst = qdf.OpenRecordset(dbOpenSnapshot)

The reason you have to do that is because you have specified...
qdf.ReturnsRecords = True

If you set that to No then you should be able to use Execute instead of
Open.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jan 19 '07 #5

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

Similar topics

6
by: dw | last post by:
Hello all, I'm having a dickens of a time calling a stored procedure on a connection. Every time I do, it generates an error "Arguments are of the wrong type, are out of acceptable range, or are in...
4
by: Bob Murdoch | last post by:
I have an ASP application that calls a COM function to create a custom report as an Excel file. This works in a synchronous fashion, as long as the report does not take too long to create. If...
2
by: June Moore | last post by:
Hi all, I have a stored procedure that return a resultset e.g. stored proc: get_employee_details select emp_id, emp_name, emp_salary, emp_position from empoloyee I would like to write...
1
by: Purple-Man | last post by:
wanted to use sp_OACreate, sp_OAMethod and sp_OADestroy to execute a DTS package from a stored procedure. I had the dba (using the sa account) create a wrapper stored procedure as recommended in...
3
by: Jack Black | last post by:
Help!! I'm trying to call a custom stored procedure from a VB.Net code-behind page in an ASP.Net application, and I keep getting an error with no real helpful info... Basically, I'm accepting a...
2
by: Woody Splawn | last post by:
I am using SQL Server 2000 as the back-end. I have created a stored procedure in SQL server called usp_AddContract. This Stored procedure inserts a new contract into a contracts table. I have...
4
by: Jack | last post by:
Hi, I am trying to run an example code from a book. However I am getting the following error message: Number: -2147217900 Description: Syntax error or access violation Source: Microsoft OLE...
1
by: amgupta8 | last post by:
Note: This problem occurred when I updated the JDK from 1.3.1 to 1.4.1 or 1.4.2. Nothing else was changed in the code, other than updating the JDK on the database server (dbm cfg parm jdk_path) and...
6
Soniad
by: Soniad | last post by:
Hello, I am excecuting a stored procedure in my ASP page , it has one out parameter (@confirm) . after executing the procedure i want to retreive this out parameter and assign it to variable...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
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
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 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.