Then it works fine!!
Problem is I need to parse the value before running to transfer to excel, otherwise I get all records and heve to split. As you can see the query is not just a simple one, so writing the sql as string runs into problems with length and parts, so I prefer the Tempvars. If...