Rocky Smolin - Beach Access Software
bchacc at san.rr.com
Tue Jun 6 23:24:03 CDT 2006
Steve (and Darren and Dan): That will replace the entire query which is what I'll do if I have to. Won't be that hard (I can copy the SQL statement right out of the SQL view into my code). But it seems to me there should be a way to manipulate queries with the same detail as something like a table where you can modify one property of one field. But apparently you can't just add or delete a field, or change a single criterion. Rocky Steve Conklin wrote: > Yep, need to edit the query def's SQL property: > > Set q = Currentdb.querydefs("my_users_query") > q.SQL = "my new sql statement" > Currentdb.querydefs.refresh > > Hth > Steve > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin - > Beach Access Software > Sent: Tuesday, June 06, 2006 8:20 PM > To: Access Developers discussion and problem solving > Subject: [AccessD] Modifying a query > > Dear List: > > Can you modify the criteria in an existing query through code? Usually I > just construct the query as a SQL statement and use db.execute to run it. > But this time I think it would be better to leave the query where it is and > modify the criterion based on a selection by the user. The query is part of > a predefined set of queries that were embedded in a macro by the user. > > MTIA, > > Rocky > > -- > Rocky Smolin > Beach Access Software > 858-259-4334 > www.e-z-mrp.com > > > -- Rocky Smolin Beach Access Software 858-259-4334 www.e-z-mrp.com