I admit, I've been developing Access applications since Access 95, and
I never thought/knew about using procs in Access. I am testing using
the following:
CREATE PROCEDURE MyProcedure AS
PARAMETERS [USER] Text ( 255 );
DELETE [ID]
FROM users
WHERE USERNAME=[USER];
Then calling it using Exec:
Exec MyProcedure "UserName"
it seems much easier to use the SQL Server method of using stored
procedures, even if just one SQL statement is allowed, then using
parameter queries that are harder to pass parameters into.
Then, using ADO:
PARAMETERS [USER] Text ( 255 );
SELECT *
FROM USERS
WHERE USERNAME=[USER];
Dim rst As New ADODB.Recordset
Dim fld As ADODB.Field
Set rst = CurrentProject.Connection.Execute("Exec SelectUser
""AdminUser""")
For Each fld In rst.Fields
Debug.Print fld.Name, fld.Value
Next fld
This makes code much more concise.
Chris Nebinger
Dirk said:
frank said:
Thanks a lot!
Could you please give me a sample through ADO to create SP?
CurrentProject.Connection.Execute _
"CREATE PROCEDURE MyProcedure AS " & _
"PARAMETERS [ID to Delete?] INTEGER; " & _
"DELETE FROM Table1 WHERE ID = [ID to Delete?];"
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)