LeanneGodney
Technical User
Hi there,
I am working with an example stored procedure (will type it out below). The procedure inserts a record into a table and then theoretically returns the ID number that it created when it inserted the new record. I can get this to work just fine in the Query Analyser screen - it runs, and it then spits out what the ID is. But for the life of me I can't figure out how to execute this stored procedure from VBA and have it return the ID to me.
If anyone knows I will forever be in your debt! ;0)
----
ALTER PROCEDURE dbo.procShipperInsert
@CompanyName nvarchar(40),
@Phone nvarchar(24),
@ShipperID int OUTPUT
AS
INSERT INTO Shippers (CompanyName, Phone)
VALUES (@CompanyName, @Phone)
SELECT @ShipperID = @@Identity
I am working with an example stored procedure (will type it out below). The procedure inserts a record into a table and then theoretically returns the ID number that it created when it inserted the new record. I can get this to work just fine in the Query Analyser screen - it runs, and it then spits out what the ID is. But for the life of me I can't figure out how to execute this stored procedure from VBA and have it return the ID to me.
If anyone knows I will forever be in your debt! ;0)
----
ALTER PROCEDURE dbo.procShipperInsert
@CompanyName nvarchar(40),
@Phone nvarchar(24),
@ShipperID int OUTPUT
AS
INSERT INTO Shippers (CompanyName, Phone)
VALUES (@CompanyName, @Phone)
SELECT @ShipperID = @@Identity