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

Ansible warning on jinja2 braces on when -

Parsing a protocol message from Go by Java -

javascript - Replicate keyboard event with html button -