[AccessD] Array as source for query

Jurgen Welz jwelz at hotmail.com
Mon Jan 22 12:00:44 CST 2007


Gustav/John:

Thanks for the welcomes back.  I have not really been gone since I'd never 
unsubscribed.  Regrettably I've only read 1 post in 50.

There has been little time for new Access work in the past year though my 
services are still required for maintenance.  I find myself in an employment 
role that requires travel throughout BC, Alberta and Saskatchewan 3 weeks 
out of the month, yet still allows me to be home nearly every weekend.  The 
best parts about the job are that it already pays over double what I used to 
make with Access with tons of benefits, like excellent medical, new vehicles 
and all fuel expenses yet it gives me more time to myself.

I will dabble here a bit more again and hopefully learn something new.

Ciao
Jürgen Welz
Edmonton, Alberta
jwelz at hotmail.com





>From: "Gustav Brock" <Gustav at cactus.dk>
>
>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

_________________________________________________________________
http://ideas.live.com/programpage.aspx?versionid=b2456790-90e6-4d28-9219-5d7207d94d45&mkt=en-ca




More information about the AccessD mailing list