Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to make the code run in an Access ADP file

Author  Topic 

Lin100
Yak Posting Veteran

70 Posts

Posted - 2006-09-26 : 17:07:21
Access 2002 and SQL 2000 Server
How to make the code run in an Access ADP (using ADO) file run

The code "Create Procedure scores" below was created in Query Analyzer and it works fine.

--------------------------------------

Create Procedure scores
@scores1 smallint,
@scores2 smallint,
@scores3 smallint,
@scores4 smallint,
@scores5 smallint,
@myAvg smallint OUTPUT
AS SELECT @myAvg = ( @scores1 + @scores2 + @scores3 + @scores4 + @scores5 ) / 5

GO

-----------------------------------------------------------------------------

The code below does run in Query Analyzer in SQL 2000 Server.
How do I convert the code below into VBA ADO for an MS Access ADP database.

DECLARE @AvgScore smallint
EXEC scores 10, 9, 8, 8, 10, @avgScore OUTPUT
SELECT 'The average Score is: ', @AvgScore
GO

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-09-26 : 17:44:02
You need to use the ADO Command object. Have a look at the ADO help file or the info on MSDN. Or google something like 'ADO Command Stored Procedures'


Go to Top of Page
   

- Advertisement -