D
Don Starnes
I have VBA code that creates a SQL query statement; I want to show the
results of the query in a tab on a form. I'm using Access 2K.
I tried using a subform ("ResultingQuery") bound to a query
("temp_SetFieldValues"), then changing the query with this code:
currentdb.QueryDefs!temp_SetFieldValues.SQL = strquery
The subform didn't refresh when the SQL string changed; I tried this
currentdb.QueryDefs.Refresh
and this:
Me!ResultingQuery.Requery
Neither refreshed the subform. I also didn't like the idea of a query with
potentially old table names being bound to my subform.
I tried binding the subform to a form ("query_view") set to datasheet view
and using this code:
Forms![query_view].RecordSource = strquery
which generated an error. I also don't know how I'd add fields to this form
from VBA.
Any advice on how I could show the results of a dynamic query on a form?
Thanks!
Don
results of the query in a tab on a form. I'm using Access 2K.
I tried using a subform ("ResultingQuery") bound to a query
("temp_SetFieldValues"), then changing the query with this code:
currentdb.QueryDefs!temp_SetFieldValues.SQL = strquery
The subform didn't refresh when the SQL string changed; I tried this
currentdb.QueryDefs.Refresh
and this:
Me!ResultingQuery.Requery
Neither refreshed the subform. I also didn't like the idea of a query with
potentially old table names being bound to my subform.
I tried binding the subform to a form ("query_view") set to datasheet view
and using this code:
Forms![query_view].RecordSource = strquery
which generated an error. I also don't know how I'd add fields to this form
from VBA.
Any advice on how I could show the results of a dynamic query on a form?
Thanks!
Don