working query fields...

B

Brad Pears

I am working in Access 2000.

I am creating a dynamic query on the fly and wonder if someone could post
code that allows me to do the following with the querydef object...

1) delete a column from the queries field list after the query has been
created
2) set a column to be NOT displayed (I want it left in the query but just
not selected for display depending on circumstances)
3) Set sort order on a particular field (I wanmt to change this at
anytime...)

I can not seem to find anything for any of this. I tried using the querydef
objects ".fields.delete("fieldname)" method but that did not work at all.
There does not appear to be much available as far as properties go on the
querydef object's field list...

Thanks, Brad
 
G

Guest

Brad,

You can create a completly different sql statement and using the QueryDef
method, update you query to that new sql statement. You could have several
different version of an sql statement and by using a Select Case statement
you could assign the desired version of the sql statement to your query based
on the criteria you want to check to determine which statement to have in the
query.

Take a look in the VBA help for QueryDef Object.
 

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