Add the SET NOCOUNT ON statement at the beginning of the SP. By the way,
DoCmd.OpenStoredProcedure is some old and strange stuff, so don't expect any
miracle from using it.
--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
"Yarik" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> Let's say there is a table named "Test" and the following stored
> procedure:
>
> ALTER PROC dbo.ShowTest
> AS
> SELECT * FROM Test
>
> When I do the following code in Access
>
> Call DoCmd.OpenStoredProcedure("dbo.ShowTest", acViewNormal,
> acReadOnly)
>
> everything works as advertised: Access opens the form displaying
> whatever records are there in the table Test.
>
> Now, let's say the stored procedure needs to re-create the table from
> scratch; for example:
>
> ALTER PROC dbo.ShowTest
> AS
> DROP TABLE Test
> SELECT 'SomeValue' AS SomeField INTO Test
> SELECT * FROM Test
>
> In this case, MS Access says that the stored procedure "...did not
> return any records..."
>
> Is there any way to make OpenStoredProcedure() able to show the
> recordset returned by the last SELECT statement in this stored
> procedure?
>
> (Actually, in my very first experiment, the stored procedure declared
> a TABLE variable, filled it with records, and at the very end called
> SELECT * FROM @TableVariable. In that case, the call to
> OpenStoredProcedure produced the same result: no records returned.
> Ideally, I would like to find a workaround for that case too, but
> something tells me that it's not going to work...)
>
> Any feedback would be greatly appreciated!
>
> Thanks,
> Yarik.
>
|