+ Reply to Thread
Results 1 to 2 of 2

Update connection CommandText

Hybrid View

  1. #1
    Registered User
    Join Date
    04-27-2010
    Location
    Louisville KY USA
    MS-Off Ver
    Excel 2003
    Posts
    25

    Update connection CommandText

    I have a standard table (not a pivot table) with a related external connection to SQL Server. Everything executes fine if I give a query defined from the GUI but I'm having trouble updating it to run dynamically.

    I tried
    ThisWorkbook.Connections("my connection name").ODBCConnection.CommandText = "my sql"
    but I get "Object doesn't support this action".

    If I iterate through the QueryTables collection in that sheet it has no query tables, despite the fact that I see one right in front of me on sheet 1! I even added a second one to make sure and the collection is still empty.

    I'm in the right scope (not in another workbook or anything)

    Any idea why the QueryTables collection would be empty?

    Thanks!

  2. #2
    Registered User
    Join Date
    04-27-2010
    Location
    Louisville KY USA
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Update connection CommandText

    Bump? Surely this is easier than I'm making it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1