Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / SQL Server / ADP / September 2004

Tip: Looking for answers? Try searching our database.

Executing a stored procedure?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gene S. - 28 Sep 2004 00:43 GMT
Hello,

How do I call(execute) a stored procedure using code in an
event within a .adp?

Any help would be greatly appreciated!
Thanks in advance
Sylvain Lafontaine - 28 Sep 2004 06:21 GMT
The easiest way is to use ADO; for example:

   Dim cmd As ADODB.Command
   Set cmd = New ADODB.Command

   cmd.ActiveConnection = CurrentProject.Connection
   cmd.CommandType = adCmdStoredProc
   cmd.CommandText = "dbo.MyStoredProcedure"
   cmd.Parameters.Append cmd.CreateParameter("@IdLigue", adInteger,
adParamInput, , IdLigue)
   cmd.Execute , , adExecuteNoRecords

and here another one, still using the previous Cmd object :
   ....
   cmd.CommandType = adCmdText
   cmd.CommandText = "select * from dbo.MyTable where ..."

   Dim rs As ADODB.Recordset
   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open cmd, , adOpenStatic, adLockReadOnly

S. L.

> Hello,
>
[quoted text clipped - 3 lines]
> Any help would be greatly appreciated!
> Thanks in advance
Alex MRu - 28 Sep 2004 22:35 GMT
If your stored procedure is simple, you may also launch it as a sql
procedure:
docmd.runsql("....")
from queries, select new; design stored procedure. design your procedure.
You may obtain the .... from the icon SQL on the stored procedure design
menu (between icons grid and very sql syntax)
This is ok for simple procedures only.
> Hello,
>
[quoted text clipped - 3 lines]
> Any help would be greatly appreciated!
> Thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.