Sure. No problem. You'll need to use VBA however, to "hold" your SQL
string while you "build" it. After that, you can either use it to do
whatever you need. On occasion, you'll need to store the string in a
QueryDef for later processing. I tend to do a _lot_ of this, by the
way. Very often, I'll find myself in need of a bunch of CrossTab
queries that need to be linked. So I build the SQL String in code,
write it to a DAO QueryDef, and go on to the next Crosstab. When I'm
done with all the CrossTabs, I usually have to build the "linking"
(summary) query which joins them all together. After that, it's not
uncommon for me to build yet another SQL query with selects off a
column or two of the summary query so that I can export the data to
excel or some other reporting instrument (HTML page or something).
Those final queries generally don't make it into a QueryDef since
there's really no need.
Anyways, yes, it's possible. And it's not all that big of a deal.
When the order of the rows is important, you may want to add in your
own ordering "column", which is included as an Expression of the query.
Just remember to Order By that column in your final query! (Yeah,
silly fingers don't always type what I tell them too....)
smith_lannynospam@hotmail.com wrote:[color=blue]
> I was wondering if it is possible to create simple queries with the
> data included in the select statement, similar to how you use the word
> VALUES (x1,x2,...) in in INSERT statement.
> The reason I want to do this is for simple graphs. For example, a pie
> chart where there are only 2 values needed and they are calculated at
> runtime. I can create a one-row query by doing something like:
> Select "value1" as Field1, "Value2" as Field2, etc.
> but I want to add an extra row or two, because the rowsource for the
> chart object requires at least two rows, the first being for labels I
> believe. Right now I am having to use temporary tables, which I do not
> like, especially for something so small.
> Also, I would like to express my thanks to this group. It has made me a
> better developer. If you were all in one place, I would send you a box
> of donuts, and Krispy Kremes too, not the cheap grocery store kind![/color]