+ Reply to Thread
Results 1 to 4 of 4

Test ODBC Connection

  1. #1
    Registered User
    Join Date
    04-29-2017
    Location
    London
    MS-Off Ver
    2016 Professional
    Posts
    50

    Test ODBC Connection

    Dear All

    Prior to refeshing connections i would like to test if the connection is available. The connection type is an ODBC to SQL server and the Connection Name is 'Calendar'. I have tried variations on the following script without success and would welcome any guidance.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Test ODBC Connection

    I am just taking a shot here, but after
    Please Login or Register  to view this content.
    Test it with
    Please Login or Register  to view this content.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Test ODBC Connection

    Quote Originally Posted by rabbit_post View Post
    Prior to refeshing connections i would like to test if the connection is available.
    Below is the code I have been using for a while. I set the connection through a function which it returns through a byreg argument (Messy but then the function can give me a True/False boolean result if the connection was successful or not).

    If the connection attempt fails, the function will report the error and close the connection. IDK if this will be of any help?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Test ODBC Connection

    I just answered a similar question for someone else. See if this logic will work for you.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to test successful connection to ODBC source using ListObject/QueryTable?
    By beacon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2013, 10:03 AM
  2. [SOLVED] Use ODBC connection without setting it up in ODBC administration
    By ExcelGal in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-18-2012, 09:59 AM
  3. ODBC Connection:
    By Miguel Martins in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2012, 02:39 PM
  4. Excel VBA makes ODBC connection to Access-How do you close the connection?
    By MrHockey in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-04-2010, 06:29 PM
  5. How to test ODBC connection
    By truant77 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 06-17-2009, 04:37 AM
  6. ODBC connection
    By ExcelUser4 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-01-2007, 05:04 PM
  7. ODBC Connection
    By Adrian T in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-25-2005, 05:06 PM

Tags for this Thread

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