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 Stored Procedures

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nexus - 17 Sep 2004 07:17 GMT
I have a stored procedure i SQL which I have created. I
want to be able to execute this procedure in VBA, thus
allowing it to read the values from the form's textboxes
and storing it into the parameter. How do I do so??

This is the codes in my stored procedure:

CREATE PROCEDURE insert_vendor

@VendorID VARCHAR (6),
@CompanyName VARCHAR (80)
AS

INSERT INTO tblVendors (VendorID, CompanyName) VALUES
(@VendorID, @CompanyName)

GO

This are the codes that I've tried out in VBA:

DoCmd.RunSQL "EXECUTE insert_vendor @VendorID =
strVendorID, @CompanyName = strCompanyName"

Thanks!
Douglas J. Steele - 17 Sep 2004 22:21 GMT
Assuming

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> I have a stored procedure i SQL which I have created. I
> want to be able to execute this procedure in VBA, thus
[quoted text clipped - 20 lines]
>
> Thanks!
Douglas J. Steele - 17 Sep 2004 22:22 GMT
Try

DoCmd.RunSQL "EXECUTE insert_vendor @VendorID = '" &
strVendorID & "', @CompanyName = '" & strCompanyName & "'"

Exagerated for clarity, that's

DoCmd.RunSQL "EXECUTE insert_vendor @VendorID = ' " &
strVendorID & " ', @CompanyName = ' " & strCompanyName & " ' "

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> I have a stored procedure i SQL which I have created. I
> want to be able to execute this procedure in VBA, thus
[quoted text clipped - 20 lines]
>
> Thanks!
 
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.