+ Reply to Thread
Results 1 to 2 of 2

Problem passing Connection string in Sub

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Problem passing Connection string in Sub

    I want to use the following procedure to operate an ODBC link
    Please Login or Register  to view this content.
    But I get a compile error at line 10 "A constant expression is required"
    When I use an ADODB connection all I need is to Dim ConStr as String
    I am trying to use sub oldSQL for three different databases all with different ConStr.
    The ODBC one defeats me because I don't know how to give the constant SAGECONN1 its string value, at least I think that's it. Can someone point me in the right direction please?
    John

    Moderator's Note: Please use titles that describe your question. I have changed your title to reflect the question.
    Last edited by Leith Ross; 08-16-2019 at 04:10 PM. Reason: Changed Title

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Use of a string constant

    Just Dim SAGECONN1 as string. It isn't a constant from your description "...for three different databases all with different ConStr."

    Try...
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

+ 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. [SOLVED] Defining a constant using a String which is called by another sub
    By excelactuary in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2018, 10:23 AM
  2. Extract name from a string, not constant data
    By seash in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-11-2016, 12:49 PM
  3. [SOLVED] Need code to pull numeric data out of an alphanumeric string (string not constant)
    By harrydnyc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2013, 04:44 PM
  4. How to extract a value of a constant that was stored in a string?
    By soldout2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2013, 07:46 AM
  5. [SOLVED] searching with wildcards on variables instead of a constant string
    By I_need in forum Excel General
    Replies: 11
    Last Post: 06-12-2012, 01:55 PM
  6. Using String in Constant
    By Foreverlearning in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-28-2012, 05:03 AM
  7. Change Defined Name Constant String
    By Ronster in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2006, 12:15 AM

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