• Hi

    Its a while since I had to do something with MS Access and SQL Server but I can remember some stuff I have done. Based on a tool for running different SP used in a migration I hammered a small MDB file together.

    The file has the following implemented:

    -Execute a SP and returning the result set into an Excel sheet or text file.

    -Execute a SP using parameters and returning a message (it just calculates Number1 * Number2)

    Before you can use the database you have to

    -enter your server name in the mdlPublicDeclaration

    -create the following two SP in the AdventureWorks database. The code to create the SP can be found in the database as well.

    USE [AdventureWorks]

    GO

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE PROCEDURE [dbo].[usp_Calculate]

    @Number1 [int],

    @Number2 [int],

    @returnMessage VARCHAR(50) OUTPUT --Parameter holding the return message

    AS

    BEGIN

    SET @returnMessage = @Number1 * @Number2

    SET @returnMessage = 'The result of this calculation is : ' + @returnMessage

    End

    USE [AdventureWorks]

    GO

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE PROCEDURE [dbo].[usp_GetEmployeeInfo]

    AS

    BEGIN

    SET NOCOUNT ON;

    SELECT Person.Contact.FirstName, Person.Contact.MiddleName, Person.Contact.LastName, Person.Contact.EmailAddress,

    HumanResources.Employee.Title

    FROM Person.Contact INNER JOIN

    HumanResources.Employee ON Person.Contact.ContactID = HumanResources.Employee.ContactID AND

    Person.Contact.ContactID = HumanResources.Employee.ContactID

    End

    Once the SP is created you can open form frmExecSP_CreateReport or frmExecSP_WithParameter and hit the run button. If you open frmExecSP_CreateReport make sure you select the SP usp_GetEmployeeInfo.

    Hope this helps.

    René