How to display and edit SQL query
I have an Excel 2007 workbook that uses several data connections (SQL queries) to pull data from an Access database. I would like to display the SQL statement for a particular named connection (Msgbox is okay). Then I would like to edit the same connection using VBA. Please help with example VBA code. Thanks.
Re: How to display and edit SQL query
add a userform with a textbox, you can then display and edit your sql query, a command button to continue the code or execute the edited query
could be a textbox in a worksheet, if you do not want a user form
Re: How to display and edit SQL query
Thanks but I'd rather not use a user form. I don't want to change the operation of the report. I'd like to display certain parts of the query in the header of the report being created. Isn't there some way, within the VBA project of the workbook, to capture the text of the SQL command of a named data connection within that workbook?
Re: How to display and edit SQL query
Quote:
within the VBA project of the workbook, to capture the text of the SQL command of a named data connection within that workbook?
yes, but you asked to display and edit
Re: How to display and edit SQL query
OK, so how do I use a text box to display the SQL statement of a certain 'Data Connection' query? Can you show a VBA code example? I really appreciate your help.