Update Query through code?

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?
 
R

Ron Weiner

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top