This one is beyond me (like so many things seem to be!)
I have attached a query that I need to convert to an SQL statement to use in code. The reason I need to use SQL is because it is designed to make a temporary table and I need to have control over the name of the table duing runtime. If there is another way to do this, please let me know.
Getting the SQL was easy, but converting it into something useful in VBA code is another matter. After some tweaking (changing double quotemarks to single, splitting lines and so forth), I’ve come up with what you will find in the attached file. Open the .mdb and everything should be self explanatory. You will see the query as it looks and works in the Query Editor. Check out the SQL for the Query (!!). Then click on the “Run SQL button” to see the error I’m getting.
By far, this most complex query I’ve designed. There may have been simpler way to do this, but this is what I came up with. If anyone has the time to look closer into this, it would be greatly appreciated.