Re: Could it be possible to create stored procedure in Access 2003

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



From the help:

CREATE PROCEDURE Statement, PROCEDURE Clause Example

This example names the query CategoryList.

This example calls the EnumFields procedure, which you can find in the
SELECT statement example.

Sub ProcedureX()
Dim dbs As Database, rst As Recordset
Dim qdf As QueryDef, strSql As String
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase("Northwind.mdb")
strSql = "PROCEDURE CategoryList; " _
& "SELECT DISTINCTROW CategoryName, " _
& "CategoryID FROM Categories " _
& "ORDER BY CategoryName;"
' Create a named QueryDef based on the SQL
' statement.
Set qdf = dbs.CreateQueryDef("NewQry", strSql)
' Create a temporary snapshot-type Recordset.
Set rst = qdf.OpenRecordset(dbOpenSnapshot)
' Populate the Recordset.
rst.MoveLast
' Call EnumFields to print the contents of the
' Recordset. Pass the Recordset object and desired
' field width.
EnumFields rst, 15
' Delete the QueryDef because this is a
' demonstration.
dbs.QueryDefs.Delete "NewQry"
dbs.Close
End Sub

I fail to see how this works any better than without the PROCEDURE
statement.


Chris Nebinger




frank wrote:
Thanks a lot!

Could you please give me a sample through ADO to create SP?

"Dirk Goldgar" wrote:

"frank" <frank@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B00C8D1D-024D-40F2-9EE7-8B02E4B3E88C@xxxxxxxxxxxxxxxx
(blank message)

Better to elaborate on your question in the body of the message.

The Jet database format (used in a normal Access database) supports
stored procedures only in the sense of stored action queries, such as
you can create on the Queries tab of the database window. Each such
query can contain only one SQL statement. They can have parameters, and
can be invoked in code by DAO, or by the user interface. The can be
also be created via the SQL CREATE PROC statement, but I think that
statement must be executed via ADO, not DAO.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)





.



Relevant Pages