Gustav Brock
Gustav at cactus.dk
Mon Jan 22 01:55:28 CST 2007
Hi Jürgen What a nice surprise. I thought you had "left the building". Yes, it can be done this way. Another use of a union query I haven't seen before. /gustav >>> jwelz at hotmail.com 22-01-2007 01:49 >>> I have used arrays to populate small queries from time to time. I looped through the array generating an SQL string and used any table name in the database. Any system usys... or other conventional table, whether it had records in it or not sufficed. The string generated was along the lines: "Select " & ar(0) & " as A From usysTable Union Select " & ar(1) & " as A >From usysTable Union Select " & ar(2) .... The loop iterated Array as with an incrementing index counter. Typically the loop would include the 'Union' in each loop and parse out the initial 'Union' with a Mid$(strsql, 6) when it exited. You have to watch Query string length limitations with this approach. Sure you need a table, but any of the built in system tables works, though you can define a table with a short name and lose the alias to maximise the number of array 'records'. Ciao Jürgen Welz Edmonton, Alberta jwelz at hotmail.com