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,
qdef.sql replaces whatever sql in pass-through query
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
Post a Comment