Update Query through code?

  • Thread starter Thread starter Gibson
  • Start date Start date
G

Gibson

I have a backend mdb and a frontend mdb. I have added a field to a table in
the backend using code. Now I need to update a query in the front end that
feeds a form to include the new field added to the table in the backend.
Can this be done through code thus the adding of the field and updating of
the query is done in at the same time as it were?
 
You want to modify the Sql property of the QueryDef for the query you are
interested in changing. You probably want to write some code like this.

== Start Air Code ==

dim qdf as dao.querydef
currentdb.querydefs.refresh
for each qdf in currentdb.querydefs
if qdf.name = "Name of the query we are interested in" then
qdf.sql = "Your new Sql statement"
end if
next

== End Air Code ==


Ron W
www.WorksRite.com
 
Back
Top