Well, I was able to create a stored procedure that returned a single record. However, it seems like a bad idea to use a stored procedure. It seems to me what you really want is a View. Anyway ...
The stored procedure looks like this.
Code:
CREATE PROCEDURE [dbo].[proc_CreateEmailTemp]
@EmailType tinyint,
@EmailTypeKey tinyint OUTPUT,
@EmailDesc nvarchar OUTPUT
AS
BEGIN
SET NOCOUNT ON;
SELECT @EmailDesc = tblEmails.EmailDesc, @EmailTypeKey = tblEmails.EmailTypeKey
FROM tblEmails
WHERE tblEmails.EmailTypeKey = @EmailType;
RETURN
END;
GO
The SQL looks like this
Code:
declare @EmailType tinyint, @TypeKey tinyint, @Description nvarchar;
EXEC [proc_CreateEmailTemp] 1, @EmailTypeKey = @TypeKey output, @EmailDesc = @Description output;
SELECT @TypeKey as EmailTypeKey, @Description as EmailDesc;
So the VBA string is this
Code:
Dim strExecProc As String
strExecProc = "declare @EmailType tinyint, @TypeKey tinyint, @Description nvarchar; " & _
"EXEC [proc_CreateEmailTemp] 1, " & _
"@EmailTypeKey = @TypeKey output, @EmailDesc = @Description output; " & _
"SELECT @TypeKey as EmailTypeKey, @Description as EmailDesc;"