After testing a query in Query designer, is there any way to convert it to VBA (handling the chr$(34)s?
I know you can save it and use it but what if some part of the WHERE clause needs to change?
After testing a query in Query designer, is there any way to convert it to VBA (handling the chr$(34)s?
I know you can save it and use it but what if some part of the WHERE clause needs to change?
Post an example of what you're dealing with? The answer is probably concatenation, but that's a guess.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Apologies @Micron, I did reply but it didn't make it here. Was just saying I had no example but were there any general rules etc.
But Colin has saved the day and the "sql2vba" is spot on and just what was needed. So thanks to you both.
One last question - and I think I'm correct - if only one table is involved you never need the tablename & "." in the query?
almost - the tablename is required to identify which field you are referring to. If the field name is unique across all the tables in your query, then you don't need the tablename. One of the reasons I recommend that with a few exceptions (such as the FK field) field names should be unique across the project, not just the table. So SaleDate, PaidDate rather than just Date (which is a reserved word anyway).and I think I'm correct - if only one table is involved you never need the tablename & "." in the query?