sql server 2008 - Return values from a pass-through query via VBA -
i have vba code run query in sql-server 2008. runs fine , displays table need. code here:
set db = currentdb set qdf = db.querydefs("mystoredprocedure") qdf.sql = "exec [wcns_ops].[dbo].mystoredprocedure [plus bunch of parameters]" docmd.openquery "mystoredprocedure"
which displays table:
my question this: how programmatically return these values vba code without displaying table?
the following code untested, should pointed in right direction:
set db = currentdb set qdf = db.querydefs("mystoredprocedure") qdf.returnsrecords = true qdf.sql = "exec [wcns_ops].[dbo].mystoredprocedure [plus bunch of parameters]" qdf.openrecordset(dbopensnapshot) 'could dbopendynaset, etc. ' until .eof debug.print !firstid debug.print !lastid .movenext loop end
Comments
Post a Comment