I have a form with some controls that let me query tables pretty fast. One of those is a textbox that displays the SQL code of the query shown in a listbox, so I can copy the SQL code, manually create a new query, paste the code, and fine tune it manually. This is also useful for copying the output, which the listbox restricts.
When a button is pressed, the controls feed the procedure, which forms a public strSQL string, which in turn is used to fill both the textbox (with the SQL code shown as text) and the listbox (via its rowsource property).
I’d like to automate the last step. That is, I would like to click on a button and have Access create a new query for me (without actually saving it if possible), paste the strSQL string and run the query. Can this be done?
DoCMD.Openquery seems to work on queries that are already created (and saved).
Thank you in advance.