+ Reply to Thread
Results 1 to 2 of 2

Multiple Temp Tables

  1. #1
    Registered User
    Join Date
    01-19-2012
    Location
    Niagara Falls, Canada
    MS-Off Ver
    Office 2010
    Posts
    8

    Multiple Temp Tables

    Need some help executing sql code from VBA. Originally I was running this code in SQL, pasting it in my excel document and just running my macro, but my manager wants to be able to do it when I'm on vacation.

    native SQL code http://pastebin.com/8wL71jSC
    Please Login or Register  to view this content.

    VBA attempt http://pastebin.com/pBsQxUw6
    Please Login or Register  to view this content.
    Basically I can connect and run each query individually if I want, but when I try to run them all its not working. My guess is once I start a new rs connection the told temp table is dropped even though is should be global.

    Am I fighting a loosing battle with Excel/VBA here? Should I attempt to merge my SQL query into one large query or perhaps put it into a stored procedure and call that instead?

    Any help would be greatly appreciated.

  2. #2
    Registered User
    Join Date
    01-19-2012
    Location
    Niagara Falls, Canada
    MS-Off Ver
    Office 2010
    Posts
    8

    Re: Multiple Temp Tables

    Thanks for looking. Think I figured it out. I just put my 3 select into statements into one string so it was all done on the same connection. I had tried that before but I think I forgot to add a space to the end of each select statement when I concatenated the string.

+ 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