B
Brian
Hello,
I'm trying to open a recordset from a stored procedure and read the rs to
populate my form but it keeps telling me that the rs is closed.
I do...
Set rs = cnnBE.Execute("exec dbo.uspGetBalance 1, '2007-1-1', 1")
With rs
Do While Not .EOF
Debug.Print !AcNo
.MoveNext
Loop
.Close
End With
and it does not work.
However this works...
cnnBE.Execute "exec dbo.uspGetBalance 1, '2007-1-1', 1"
Set rs = cnnBE.Execute("SELECT * from tbltmpLastID WHERE UserNo = 1")
With rs
Do While Not .EOF
Debug.Print !AcNo
.MoveNext
Loop
.Close
End With
The procedure is
CREATE PROCEDURE uspGetBalance
@AcType as TinyInt,
@EndDate as DateTime,
@UserNo as TinyInt
AS
/*fill tbltmpLastID with the balances */
exec uspGetbalances @AcType, @EndDate, @UserNo
SELECT * from tbltmpLastID WHERE UserNo = @UserNo
GO
I can use the sql query analyser an do
exec dbo.uspGetBalance 1, '2007-1-1', 1
and it gives me the results straight off.
What am I doing wrong?
Thanks a lot
Brian
I'm trying to open a recordset from a stored procedure and read the rs to
populate my form but it keeps telling me that the rs is closed.
I do...
Set rs = cnnBE.Execute("exec dbo.uspGetBalance 1, '2007-1-1', 1")
With rs
Do While Not .EOF
Debug.Print !AcNo
.MoveNext
Loop
.Close
End With
and it does not work.
However this works...
cnnBE.Execute "exec dbo.uspGetBalance 1, '2007-1-1', 1"
Set rs = cnnBE.Execute("SELECT * from tbltmpLastID WHERE UserNo = 1")
With rs
Do While Not .EOF
Debug.Print !AcNo
.MoveNext
Loop
.Close
End With
The procedure is
CREATE PROCEDURE uspGetBalance
@AcType as TinyInt,
@EndDate as DateTime,
@UserNo as TinyInt
AS
/*fill tbltmpLastID with the balances */
exec uspGetbalances @AcType, @EndDate, @UserNo
SELECT * from tbltmpLastID WHERE UserNo = @UserNo
GO
I can use the sql query analyser an do
exec dbo.uspGetBalance 1, '2007-1-1', 1
and it gives me the results straight off.
What am I doing wrong?
Thanks a lot
Brian