I've got a lengthy piece of SQL which I need to be able to run and return to excel. With this sort of thing I normally cheat and use the record function to create a background query which I can then add my variables into etc but because this SQL statement is so long it's just not playing ball

I think this is due to the sql statement being formed in an array in VB which is limited to certain parameters(?)

Can anyone offer any advice on how this can be done?

Any advice much appreciated...