MS Access Generic Pass-Through Query to SQL Server -


i set pass-through query in ms access. generic in sense can set sql on fly via dao.querydef ".sql" property.

problem is, cannot seem set ".returnsrecords" property on fly. whatever in query's property sheet seems stuck there.

an example might helpful:

dim qdef dao.querydef  set qdef = currentdb.querydefs(gpassthru) qdef.returnsrecords = false  ' or true qdef.sql = "exec dbo.sp_whatever" 

to reiterate,

  1. qdef.sql replaces whatever sql in pass-through query

  2. qdef.returnsrecords not replace property sheet definition of pass-through

is there way of making query generic, or need create separate queries based on whether records returned?

this seems trick -- @ least in case don't need records back. c perkins steering me in direction.

dim strsql string dim qdef dao.querydef  set qdef = currentdb.createquerydef("") 'temporary pass-through strsql = "exec dbo.sp_whatever"  qdef   .connect = gconnect   .sql = strsql   .returnsrecords = false   .execute end  set qdef = nothing 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -